home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / gcc270_src.lha / gcc-2.7.0-amiga / toplev.c < prev    next >
C/C++ Source or Header  |  1995-08-24  |  107KB  |  4,108 lines

  1. /* Top level of GNU C compiler
  2.    Copyright (C) 1987, 88, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 59 Temple Place - Suite 330,
  19. Boston, MA 02111-1307, USA.  */
  20.  
  21. /* This is the top level of cc1/c++.
  22.    It parses command args, opens files, invokes the various passes
  23.    in the proper order, and counts the time used by each.
  24.    Error messages and low-level interface to malloc also handled here.  */
  25.  
  26. #include "config.h"
  27. #ifdef __STDC__
  28. #include <stdarg.h>
  29. #else
  30. #include <varargs.h>
  31. #endif
  32. #include <stdio.h>
  33. #include <signal.h>
  34. #include <setjmp.h>
  35. #include <sys/types.h>
  36. #include <ctype.h>
  37. #include <sys/stat.h>
  38.  
  39. #ifndef _WIN32
  40. #ifdef USG
  41. #undef FLOAT
  42. #include <sys/param.h>
  43. /* This is for hpux.  It is a real screw.  They should change hpux.  */
  44. #undef FLOAT
  45. #include <sys/times.h>
  46. #include <time.h>   /* Correct for hpux at least.  Is it good on other USG?  */
  47. #undef FFS  /* Some systems define this in param.h.  */
  48. #else
  49. #ifndef VMS
  50. #include <sys/time.h>
  51. #include <sys/resource.h>
  52. #endif
  53. #endif
  54. #endif
  55.  
  56. #include "input.h"
  57. #include "tree.h"
  58. #ifdef __amigados__
  59. #define SUPPRESS_RTL_FLOAT_DEFINITION    /* Avoid <exec/types.h> and rtl.def typedef clash for "float" */
  60. #endif
  61. #include "rtl.h"
  62. #include "flags.h"
  63. #include "insn-attr.h"
  64. #include "defaults.h"
  65. #include "output.h"
  66. #include "bytecode.h"
  67. #include "bc-emit.h"
  68.  
  69. #ifdef XCOFF_DEBUGGING_INFO
  70. #include "xcoffout.h"
  71. #endif
  72.  
  73. #ifdef VMS
  74. /* The extra parameters substantially improve the I/O performance.  */
  75. static FILE *
  76. vms_fopen (fname, type)
  77.      char * fname;
  78.      char * type;
  79. {
  80.   /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
  81.      fixed arguments, which matches ANSI's specification but not VAXCRTL's
  82.      pre-ANSI implementation.  This hack circumvents the mismatch problem.  */
  83.   FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
  84.  
  85.   if (*type == 'w')
  86.     return (*vmslib_fopen) (fname, type, "mbc=32",
  87.                 "deq=64", "fop=tef", "shr=nil");
  88.   else
  89.     return (*vmslib_fopen) (fname, type, "mbc=32");
  90. }
  91. #define fopen vms_fopen
  92. #endif    /* VMS */
  93.  
  94. #ifndef DEFAULT_GDB_EXTENSIONS
  95. #define DEFAULT_GDB_EXTENSIONS 1
  96. #endif
  97.  
  98. extern int rtx_equal_function_value_matters;
  99.  
  100. #if ! (defined (VMS) || defined (OS2))
  101. extern char **environ;
  102. #endif
  103. extern char *version_string, *language_string;
  104.  
  105. /* Carry information from ASM_DECLARE_OBJECT_NAME
  106.    to ASM_FINISH_DECLARE_OBJECT.  */
  107.  
  108. extern int size_directive_output;
  109. extern tree last_assemble_variable_decl;
  110.  
  111. extern void init_lex ();
  112. extern void init_decl_processing ();
  113. extern void init_obstacks ();
  114. extern void init_tree_codes ();
  115. extern void init_rtl ();
  116. extern void init_regs ();
  117. extern void init_optabs ();
  118. extern void init_stmt ();
  119. extern void init_reg_sets ();
  120. extern void dump_flow_info ();
  121. extern void dump_sched_info ();
  122. extern void dump_local_alloc ();
  123.  
  124. void rest_of_decl_compilation ();
  125. void error_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
  126. void error_with_decl PVPROTO((tree decl, char *s, ...));
  127. void error_for_asm PVPROTO((rtx insn, char *s, ...));
  128. void error PVPROTO((char *s, ...));
  129. void fatal PVPROTO((char *s, ...));
  130. void warning_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
  131. void warning_with_decl PVPROTO((tree decl, char *s, ...));
  132. void warning_for_asm PVPROTO((rtx insn, char *s, ...));
  133. void warning PVPROTO((char *s, ...));
  134. void pedwarn PVPROTO((char *s, ...));
  135. void pedwarn_with_decl PVPROTO((tree decl, char *s, ...));
  136. void pedwarn_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
  137. void sorry PVPROTO((char *s, ...));
  138. void really_sorry PVPROTO((char *s, ...));
  139. void fancy_abort ();
  140. #ifndef abort
  141. void abort ();
  142. #endif
  143. void set_target_switch ();
  144. static void print_switch_values ();
  145. static char *decl_name ();
  146.  
  147. #ifdef __amigados__
  148. /* Phil.B: 03-Oct-94 Flag indicating process priority */
  149. static int amiga_priority = -1;
  150. static int amiga_old_priority;
  151. #include <proto/exec.h>
  152. struct Task *amiga_task;
  153. #endif /* __amigados__ */
  154.  
  155. /* Name of program invoked, sans directories.  */
  156.  
  157. char *progname;
  158.  
  159. /* Copy of arguments to main.  */
  160. int save_argc;
  161. char **save_argv;
  162.  
  163. /* Name of current original source file (what was input to cpp).
  164.    This comes from each #-command in the actual input.  */
  165.  
  166. char *input_filename;
  167.  
  168. /* Name of top-level original source file (what was input to cpp).
  169.    This comes from the #-command at the beginning of the actual input.
  170.    If there isn't any there, then this is the cc1 input file name.  */
  171.  
  172. char *main_input_filename;
  173.  
  174. /* Stream for reading from the input file.  */
  175.  
  176. FILE *finput;
  177.  
  178. /* Current line number in real source file.  */
  179.  
  180. int lineno;
  181.  
  182. /* Stack of currently pending input files.  */
  183.  
  184. struct file_stack *input_file_stack;
  185.  
  186. /* Incremented on each change to input_file_stack.  */
  187. int input_file_stack_tick;
  188.  
  189. /* FUNCTION_DECL for function now being parsed or compiled.  */
  190.  
  191. extern tree current_function_decl;
  192.  
  193. /* Name to use as base of names for dump output files.  */
  194.  
  195. char *dump_base_name;
  196.  
  197. /* Bit flags that specify the machine subtype we are compiling for.
  198.    Bits are tested using macros TARGET_... defined in the tm.h file
  199.    and set by `-m...' switches.  Must be defined in rtlanal.c.  */
  200.  
  201. extern int target_flags;
  202.  
  203. /* Flags saying which kinds of debugging dump have been requested.  */
  204.  
  205. int rtl_dump = 0;
  206. int rtl_dump_and_exit = 0;
  207. int jump_opt_dump = 0;
  208. int cse_dump = 0;
  209. int loop_dump = 0;
  210. int cse2_dump = 0;
  211. int flow_dump = 0;
  212. int combine_dump = 0;
  213. int sched_dump = 0;
  214. int local_reg_dump = 0;
  215. int global_reg_dump = 0;
  216. int sched2_dump = 0;
  217. int jump2_opt_dump = 0;
  218. int dbr_sched_dump = 0;
  219. int flag_print_asm_name = 0;
  220. int stack_reg_dump = 0;
  221.  
  222. /* Name for output file of assembly code, specified with -o.  */
  223.  
  224. char *asm_file_name;
  225.  
  226. /* Value of the -G xx switch, and whether it was passed or not.  */
  227. int g_switch_value;
  228. int g_switch_set;
  229.  
  230. /* Type(s) of debugging information we are producing (if any).
  231.    See flags.h for the definitions of the different possible
  232.    types of debugging information.  */
  233. enum debug_info_type write_symbols = NO_DEBUG;
  234.  
  235. /* Level of debugging information we are producing.  See flags.h
  236.    for the definitions of the different possible levels.  */
  237. enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
  238.  
  239. /* Nonzero means use GNU-only extensions in the generated symbolic
  240.    debugging information.  */
  241. /* Currently, this only has an effect when write_symbols is set to
  242.    DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG.  */
  243. int use_gnu_debug_info_extensions = 0;
  244.  
  245. /* Nonzero means do optimizations.  -O.
  246.    Particular numeric values stand for particular amounts of optimization;
  247.    thus, -O2 stores 2 here.  However, the optimizations beyond the basic
  248.    ones are not controlled directly by this variable.  Instead, they are
  249.    controlled by individual `flag_...' variables that are defaulted
  250.    based on this variable.  */
  251.  
  252. int optimize = 0;
  253.  
  254. /* Number of error messages and warning messages so far.  */
  255.  
  256. int errorcount = 0;
  257. int warningcount = 0;
  258. int sorrycount = 0;
  259.  
  260. /* Flag to output bytecode instead of native assembler */
  261. int output_bytecode = 0;
  262.  
  263. /* Pointer to function to compute the name to use to print a declaration.  */
  264.  
  265. char *(*decl_printable_name) ();
  266.  
  267. /* Pointer to function to compute rtl for a language-specific tree code.  */
  268.  
  269. struct rtx_def *(*lang_expand_expr) ();
  270.  
  271. /* Pointer to function to finish handling an incomplete decl at the
  272.    end of compilation.  */
  273.  
  274. void (*incomplete_decl_finalize_hook) () = 0;
  275.  
  276. /* Pointer to function for interim exception handling implementation.
  277.    This interface will change, and it is only here until a better interface
  278.    replaces it.  */
  279.  
  280. void (*interim_eh_hook)    PROTO((tree));
  281.  
  282. /* Nonzero if generating code to do profiling.  */
  283.  
  284. int profile_flag = 0;
  285.  
  286. /* Nonzero if generating code to do profiling on a line-by-line basis.  */
  287.  
  288. int profile_block_flag;
  289.  
  290. /* Nonzero for -pedantic switch: warn about anything
  291.    that standard spec forbids.  */
  292.  
  293. int pedantic = 0;
  294.  
  295. /* Temporarily suppress certain warnings.
  296.    This is set while reading code from a system header file.  */
  297.  
  298. int in_system_header = 0;
  299.  
  300. /* Nonzero means do stupid register allocation.
  301.    Currently, this is 1 if `optimize' is 0.  */
  302.  
  303. int obey_regdecls = 0;
  304.  
  305. /* Don't print functions as they are compiled and don't print
  306.    times taken by the various passes.  -quiet.  */
  307.  
  308. int quiet_flag = 0;
  309.  
  310. /* -f flags.  */
  311.  
  312. /* Nonzero means `char' should be signed.  */
  313.  
  314. int flag_signed_char;
  315.  
  316. /* Nonzero means give an enum type only as many bytes as it needs.  */
  317.  
  318. int flag_short_enums;
  319.  
  320. /* Nonzero for -fcaller-saves: allocate values in regs that need to
  321.    be saved across function calls, if that produces overall better code.
  322.    Optional now, so people can test it.  */
  323.  
  324. #ifdef DEFAULT_CALLER_SAVES
  325. int flag_caller_saves = 1;
  326. #else
  327. int flag_caller_saves = 0;
  328. #endif
  329.  
  330. /* Nonzero if structures and unions should be returned in memory.
  331.  
  332.    This should only be defined if compatibility with another compiler or
  333.    with an ABI is needed, because it results in slower code.  */
  334.  
  335. #ifndef DEFAULT_PCC_STRUCT_RETURN
  336. #define DEFAULT_PCC_STRUCT_RETURN 1
  337. #endif
  338.  
  339. /* Nonzero for -fpcc-struct-return: return values the same way PCC does.  */
  340.  
  341. int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
  342.  
  343. /* Nonzero for -fforce-mem: load memory value into a register
  344.    before arithmetic on it.  This makes better cse but slower compilation.  */
  345.  
  346. int flag_force_mem = 0;
  347.  
  348. /* Nonzero for -fforce-addr: load memory address into a register before
  349.    reference to memory.  This makes better cse but slower compilation.  */
  350.  
  351. int flag_force_addr = 0;
  352.  
  353. /* Nonzero for -fdefer-pop: don't pop args after each function call;
  354.    instead save them up to pop many calls' args with one insns.  */
  355.  
  356. int flag_defer_pop = 0;
  357.  
  358. /* Nonzero for -ffloat-store: don't allocate floats and doubles
  359.    in extended-precision registers.  */
  360.  
  361. int flag_float_store = 0;
  362.  
  363. /* Nonzero for -fcse-follow-jumps:
  364.    have cse follow jumps to do a more extensive job.  */
  365.  
  366. int flag_cse_follow_jumps;
  367.  
  368. /* Nonzero for -fcse-skip-blocks:
  369.    have cse follow a branch around a block.  */
  370. int flag_cse_skip_blocks;
  371.  
  372. /* Nonzero for -fexpensive-optimizations:
  373.    perform miscellaneous relatively-expensive optimizations.  */
  374. int flag_expensive_optimizations;
  375.  
  376. /* Nonzero for -fthread-jumps:
  377.    have jump optimize output of loop.  */
  378.  
  379. int flag_thread_jumps;
  380.  
  381. /* Nonzero enables strength-reduction in loop.c.  */
  382.  
  383. int flag_strength_reduce = 0;
  384.  
  385. /* Nonzero enables loop unrolling in unroll.c.  Only loops for which the
  386.    number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
  387.    UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
  388.    unrolled.  */
  389.  
  390. int flag_unroll_loops;
  391.  
  392. /* Nonzero enables loop unrolling in unroll.c.  All loops are unrolled.
  393.    This is generally not a win.  */
  394.  
  395. int flag_unroll_all_loops;
  396.  
  397. /* Nonzero for -fwritable-strings:
  398.    store string constants in data segment and don't uniquize them.  */
  399.  
  400. int flag_writable_strings = 0;
  401.  
  402. /* Nonzero means don't put addresses of constant functions in registers.
  403.    Used for compiling the Unix kernel, where strange substitutions are
  404.    done on the assembly output.  */
  405.  
  406. int flag_no_function_cse = 0;
  407.  
  408. /* Nonzero for -fomit-frame-pointer:
  409.    don't make a frame pointer in simple functions that don't require one.  */
  410.  
  411. int flag_omit_frame_pointer = 0;
  412.  
  413. /* Nonzero to inhibit use of define_optimization peephole opts.  */
  414.  
  415. int flag_no_peephole = 0;
  416.  
  417. /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
  418.    operations in the interest of optimization.  For example it allows
  419.    GCC to assume arguments to sqrt are nonnegative numbers, allowing
  420.    faster code for sqrt to be generated. */
  421.  
  422. int flag_fast_math = 0;
  423.  
  424. /* Nonzero means all references through pointers are volatile.  */
  425.  
  426. int flag_volatile;
  427.  
  428. /* Nonzero means treat all global and extern variables as global.  */
  429.  
  430. int flag_volatile_global;
  431.  
  432. /* Nonzero means just do syntax checking; don't output anything.  */
  433.  
  434. int flag_syntax_only = 0;
  435.  
  436. /* Nonzero means to rerun cse after loop optimization.  This increases
  437.    compilation time about 20% and picks up a few more common expressions.  */
  438.  
  439. static int flag_rerun_cse_after_loop;
  440.  
  441. /* Nonzero for -finline-functions: ok to inline functions that look like
  442.    good inline candidates.  */
  443.  
  444. int flag_inline_functions;
  445.  
  446. /* Nonzero for -fkeep-inline-functions: even if we make a function
  447.    go inline everywhere, keep its definition around for debugging
  448.    purposes.  */
  449.  
  450. int flag_keep_inline_functions;
  451.  
  452. /* Nonzero means that functions will not be inlined.  */
  453.  
  454. int flag_no_inline;
  455.  
  456. /* Nonzero means we should be saving declaration info into a .X file.  */
  457.  
  458. int flag_gen_aux_info = 0;
  459.  
  460. /* Specified name of aux-info file.  */
  461.  
  462. static char *aux_info_file_name;
  463.  
  464. /* Nonzero means make the text shared if supported.  */
  465.  
  466. int flag_shared_data;
  467.  
  468. /* Nonzero means schedule into delayed branch slots if supported.  */
  469.  
  470. int flag_delayed_branch;
  471.  
  472. /* Nonzero means to run cleanups after CALL_EXPRs.  */
  473.  
  474. int flag_short_temps;
  475.  
  476. /* Nonzero if we are compiling pure (sharable) code.
  477.    Value is 1 if we are doing reasonable (i.e. simple
  478.    offset into offset table) pic.  Value is 2 if we can
  479.    only perform register offsets.  */
  480.  
  481. int flag_pic;
  482.  
  483. /* Nonzero means place uninitialized global data in the bss section. */
  484.  
  485. int flag_no_common;
  486.  
  487. /* Nonzero means pretend it is OK to examine bits of target floats,
  488.    even if that isn't true.  The resulting code will have incorrect constants,
  489.    but the same series of instructions that the native compiler would make.  */
  490.  
  491. int flag_pretend_float;
  492.  
  493. /* Nonzero means change certain warnings into errors.
  494.    Usually these are warnings about failure to conform to some standard.  */
  495.  
  496. int flag_pedantic_errors = 0;
  497.  
  498. /* flag_schedule_insns means schedule insns within basic blocks (before
  499.    local_alloc).
  500.    flag_schedule_insns_after_reload means schedule insns after
  501.    global_alloc.  */
  502.  
  503. int flag_schedule_insns = 0;
  504. int flag_schedule_insns_after_reload = 0;
  505.  
  506. /* -finhibit-size-directive inhibits output of .size for ELF.
  507.    This is used only for compiling crtstuff.c, 
  508.    and it may be extended to other effects
  509.    needed for crtstuff.c on other systems.  */
  510. int flag_inhibit_size_directive = 0;
  511.  
  512. /* -fverbose-asm causes extra commentary information to be produced in
  513.    the generated assembly code (to make it more readable).  This option
  514.    is generally only of use to those who actually need to read the
  515.    generated assembly code (perhaps while debugging the compiler itself).  */
  516.  
  517. int flag_verbose_asm = 0;
  518.  
  519. /* -fgnu-linker specifies use of the GNU linker for initializations.
  520.    (Or, more generally, a linker that handles initializations.)
  521.    -fno-gnu-linker says that collect2 will be used.  */
  522. #ifdef USE_COLLECT2
  523. int flag_gnu_linker = 0;
  524. #else
  525. int flag_gnu_linker = 1;
  526. #endif
  527.  
  528. /* Tag all structures with __attribute__(packed) */
  529. int flag_pack_struct = 0;
  530.  
  531. /* Table of language-independent -f options.
  532.    STRING is the option name.  VARIABLE is the address of the variable.
  533.    ON_VALUE is the value to store in VARIABLE
  534.     if `-fSTRING' is seen as an option.
  535.    (If `-fno-STRING' is seen as an option, the opposite value is stored.)  */
  536.  
  537. struct { char *string; int *variable; int on_value;} f_options[] =
  538. {
  539.   {"float-store", &flag_float_store, 1},
  540.   {"volatile", &flag_volatile, 1},
  541.   {"volatile-global", &flag_volatile_global, 1},
  542.   {"defer-pop", &flag_defer_pop, 1},
  543.   {"omit-frame-pointer", &flag_omit_frame_pointer, 1},
  544.   {"cse-follow-jumps", &flag_cse_follow_jumps, 1},
  545.   {"cse-skip-blocks", &flag_cse_skip_blocks, 1},
  546.   {"expensive-optimizations", &flag_expensive_optimizations, 1},
  547.   {"thread-jumps", &flag_thread_jumps, 1},
  548.   {"strength-reduce", &flag_strength_reduce, 1},
  549.   {"unroll-loops", &flag_unroll_loops, 1},
  550.   {"unroll-all-loops", &flag_unroll_all_loops, 1},
  551.   {"writable-strings", &flag_writable_strings, 1},
  552.   {"peephole", &flag_no_peephole, 0},
  553.   {"large-baserel", &flag_pic, 4},
  554.   {"force-mem", &flag_force_mem, 1},
  555.   {"force-addr", &flag_force_addr, 1},
  556.   {"function-cse", &flag_no_function_cse, 0},
  557.   {"inline-functions", &flag_inline_functions, 1},
  558.   {"keep-inline-functions", &flag_keep_inline_functions, 1},
  559.   {"inline", &flag_no_inline, 0},
  560.   {"syntax-only", &flag_syntax_only, 1},
  561.   {"shared-data", &flag_shared_data, 1},
  562.   {"caller-saves", &flag_caller_saves, 1},
  563.   {"pcc-struct-return", &flag_pcc_struct_return, 1},
  564.   {"reg-struct-return", &flag_pcc_struct_return, 0},
  565.   {"delayed-branch", &flag_delayed_branch, 1},
  566.   {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1},
  567.   {"pretend-float", &flag_pretend_float, 1},
  568.   {"schedule-insns", &flag_schedule_insns, 1},
  569.   {"schedule-insns2", &flag_schedule_insns_after_reload, 1},
  570.   {"pic", &flag_pic, 1},
  571.   {"PIC", &flag_pic, 2},
  572.   {"baserel", &flag_pic, 3},
  573.   {"fast-math", &flag_fast_math, 1},
  574.   {"common", &flag_no_common, 0},
  575.   {"inhibit-size-directive", &flag_inhibit_size_directive, 1},
  576.   {"verbose-asm", &flag_verbose_asm, 1},
  577.   {"gnu-linker", &flag_gnu_linker, 1},
  578.   {"pack-struct", &flag_pack_struct, 1},
  579.   {"bytecode", &output_bytecode, 1}
  580. };
  581.  
  582. /* Table of language-specific options.  */
  583.  
  584. char *lang_options[] =
  585. {
  586.   "-ansi",
  587.   "-fallow-single-precision",
  588.  
  589.   "-fsigned-bitfields",
  590.   "-funsigned-bitfields",
  591.   "-fno-signed-bitfields",
  592.   "-fno-unsigned-bitfields",
  593.   "-fsigned-char",
  594.   "-funsigned-char",
  595.   "-fno-signed-char",
  596.   "-fno-unsigned-char",
  597.  
  598.   "-ftraditional",
  599.   "-traditional",
  600.   "-fnotraditional",
  601.   "-fno-traditional",
  602.  
  603.   "-fasm",
  604.   "-fno-asm",
  605.   "-fbuiltin",
  606.   "-fno-builtin",
  607.   "-fcond-mismatch",
  608.   "-fno-cond-mismatch",
  609.   "-fdollars-in-identifiers",
  610.   "-fno-dollars-in-identifiers",
  611.   "-fident",
  612.   "-fno-ident",
  613.   "-fshort-double",
  614.   "-fno-short-double",
  615.   "-fshort-enums",
  616.   "-fno-short-enums",
  617.  
  618.   "-Wall",
  619.   "-Wbad-function-cast",
  620.   "-Wno-bad-function-cast",
  621.   "-Wcast-qual",
  622.   "-Wno-cast-qual",
  623.   "-Wchar-subscripts",
  624.   "-Wno-char-subscripts",
  625.   "-Wcomment",
  626.   "-Wno-comment",
  627.   "-Wcomments",
  628.   "-Wno-comments",
  629.   "-Wconversion",
  630.   "-Wno-conversion",
  631.   "-Wformat",
  632.   "-Wno-format",
  633.   "-Wimport",
  634.   "-Wno-import",
  635.   "-Wimplicit",
  636.   "-Wno-implicit",
  637.   "-Wmissing-braces",
  638.   "-Wno-missing-braces",
  639.   "-Wmissing-declarations",
  640.   "-Wno-missing-declarations",
  641.   "-Wmissing-prototypes",
  642.   "-Wno-missing-prototypes",
  643.   "-Wnested-externs",
  644.   "-Wno-nested-externs",
  645.   "-Wparentheses",
  646.   "-Wno-parentheses",
  647.   "-Wpointer-arith",
  648.   "-Wno-pointer-arith",
  649.   "-Wredundant-decls",
  650.   "-Wno-redundant-decls",
  651.   "-Wstrict-prototypes",
  652.   "-Wno-strict-prototypes",
  653.   "-Wtraditional",
  654.   "-Wno-traditional",
  655.   "-Wtrigraphs",
  656.   "-Wno-trigraphs",
  657.   "-Wwrite-strings",
  658.   "-Wno-write-strings",
  659.  
  660.   /* these are for obj c */
  661.   "-lang-objc",
  662.   "-gen-decls",
  663.   "-fgnu-runtime",
  664.   "-fno-gnu-runtime",
  665.   "-fnext-runtime",
  666.   "-fno-next-runtime",
  667.   "-Wselector",
  668.   "-Wno-selector",
  669.   "-Wprotocol",
  670.   "-Wno-protocol",
  671.  
  672. #include "options.h"
  673.   0
  674. };
  675.  
  676. /* Options controlling warnings */
  677.  
  678. /* Don't print warning messages.  -w.  */
  679.  
  680. int inhibit_warnings = 0;
  681.  
  682. /* Print various extra warnings.  -W.  */
  683.  
  684. int extra_warnings = 0;
  685.  
  686. /* Treat warnings as errors.  -Werror.  */
  687.  
  688. int warnings_are_errors = 0;
  689.  
  690. /* Nonzero to warn about unused local variables.  */
  691.  
  692. int warn_unused;
  693.  
  694. /* Nonzero to warn about variables used before they are initialized.  */
  695.  
  696. int warn_uninitialized;
  697.  
  698. /* Nonzero means warn about all declarations which shadow others.   */
  699.  
  700. int warn_shadow;
  701.  
  702. /* Warn if a switch on an enum fails to have a case for every enum value.  */
  703.  
  704. int warn_switch;
  705.  
  706. /* Nonzero means warn about function definitions that default the return type
  707.    or that use a null return and have a return-type other than void.  */
  708.  
  709. int warn_return_type;
  710.  
  711. /* Nonzero means warn about pointer casts that increase the required
  712.    alignment of the target type (and might therefore lead to a crash
  713.    due to a misaligned access).  */
  714.  
  715. int warn_cast_align;
  716.  
  717. /* Nonzero means warn about any identifiers that match in the first N
  718.    characters.  The value N is in `id_clash_len'.  */
  719.  
  720. int warn_id_clash;
  721. unsigned id_clash_len;
  722.  
  723. /* Nonzero means warn about any objects definitions whose size is larger
  724.    than N bytes.  Also want about function definitions whose returned
  725.    values are larger than N bytes. The value N is in `larger_than_size'.  */
  726.  
  727. int warn_larger_than;
  728. unsigned larger_than_size;
  729.  
  730. /* Nonzero means warn if inline function is too large.  */
  731.  
  732. int warn_inline;
  733.  
  734. /* Warn if a function returns an aggregate,
  735.    since there are often incompatible calling conventions for doing this.  */
  736.  
  737. int warn_aggregate_return;
  738.  
  739. /* Likewise for -W.  */
  740.  
  741. struct { char *string; int *variable; int on_value;} W_options[] =
  742. {
  743.   {"unused", &warn_unused, 1},
  744.   {"error", &warnings_are_errors, 1},
  745.   {"shadow", &warn_shadow, 1},
  746.   {"switch", &warn_switch, 1},
  747.   {"aggregate-return", &warn_aggregate_return, 1},
  748.   {"cast-align", &warn_cast_align, 1},
  749.   {"uninitialized", &warn_uninitialized, 1},
  750.   {"inline", &warn_inline, 1}
  751. };
  752.  
  753. /* Output files for assembler code (real compiler output)
  754.    and debugging dumps.  */
  755.  
  756. FILE *asm_out_file;
  757. FILE *aux_info_file;
  758. FILE *rtl_dump_file;
  759. FILE *jump_opt_dump_file;
  760. FILE *cse_dump_file;
  761. FILE *loop_dump_file;
  762. FILE *cse2_dump_file;
  763. FILE *flow_dump_file;
  764. FILE *combine_dump_file;
  765. FILE *sched_dump_file;
  766. FILE *local_reg_dump_file;
  767. FILE *global_reg_dump_file;
  768. FILE *sched2_dump_file;
  769. FILE *jump2_opt_dump_file;
  770. FILE *dbr_sched_dump_file;
  771. FILE *stack_reg_dump_file;
  772.  
  773. /* Time accumulators, to count the total time spent in various passes.  */
  774.  
  775. int parse_time;
  776. int varconst_time;
  777. int integration_time;
  778. int jump_time;
  779. int cse_time;
  780. int loop_time;
  781. int cse2_time;
  782. int flow_time;
  783. int combine_time;
  784. int sched_time;
  785. int local_alloc_time;
  786. int global_alloc_time;
  787. int sched2_time;
  788. int dbr_sched_time;
  789. int shorten_branch_time;
  790. int stack_reg_time;
  791. int final_time;
  792. int symout_time;
  793. int dump_time;
  794.  
  795. /* Return time used so far, in microseconds.  */
  796.  
  797. int
  798. get_run_time ()
  799. {
  800. #ifndef _WIN32
  801. #ifdef USG
  802.   struct tms tms;
  803. #else
  804. #ifndef VMS
  805.   struct rusage rusage;
  806. #else
  807.   struct
  808.     {
  809.       int proc_user_time;
  810.       int proc_system_time;
  811.       int child_user_time;
  812.       int child_system_time;
  813.     } vms_times;
  814. #endif
  815. #endif
  816. #endif
  817.  
  818.   if (quiet_flag)
  819.     return 0;
  820. #ifdef _WIN32
  821.   if (clock() < 0)
  822.     return 0;
  823.   else
  824.     return (clock() * 1000);
  825. #else /* not _WIN32 */
  826. #ifdef USG
  827.   times (&tms);
  828.   return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  829. #else
  830. #ifndef VMS
  831.   getrusage (0, &rusage);
  832.   return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
  833.       + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
  834. #else /* VMS */
  835.   times (&vms_times);
  836.   return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
  837. #endif
  838. #endif
  839. #endif
  840. }
  841.  
  842. #define TIMEVAR(VAR, BODY)    \
  843. do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
  844.  
  845. void
  846. print_time (str, total)
  847.      char *str;
  848.      int total;
  849. {
  850.   fprintf (stderr,
  851.        "time in %s: %d.%06d\n",
  852.        str, total / 1000000, total % 1000000);
  853. }
  854.  
  855. /* Count an error or warning.  Return 1 if the message should be printed.  */
  856.  
  857. int
  858. count_error (warningp)
  859.      int warningp;
  860. {
  861.   if (warningp && inhibit_warnings)
  862.     return 0;
  863.  
  864.   if (warningp && !warnings_are_errors)
  865.     warningcount++;
  866.   else
  867.     {
  868.       static int warning_message = 0;
  869.  
  870.       if (warningp && !warning_message)
  871.     {
  872.       fprintf (stderr, "%s: warnings being treated as errors\n", progname);
  873.       warning_message = 1;
  874.     }
  875.       errorcount++;
  876.     }
  877.  
  878.   return 1;
  879. }
  880.  
  881. /* Print a fatal error message.  NAME is the text.
  882.    Also include a system error message based on `errno'.  */
  883.  
  884. void
  885. pfatal_with_name (name)
  886.      char *name;
  887. {
  888.   fprintf (stderr, "%s: ", progname);
  889.   perror (name);
  890.   exit (FATAL_EXIT_CODE);
  891. }
  892.  
  893. void
  894. fatal_io_error (name)
  895.      char *name;
  896. {
  897.   fprintf (stderr, "%s: %s: I/O error\n", progname, name);
  898.   exit (FATAL_EXIT_CODE);
  899. }
  900.  
  901. /* Called to give a better error message for a bad insn rather than
  902.    just calling abort().  */
  903.  
  904. void
  905. fatal_insn (message, insn)
  906.      char *message;
  907.      rtx insn;
  908. {
  909.   if (!output_bytecode)
  910.     {
  911.       error (message);
  912.       debug_rtx (insn);
  913.     }
  914.   if (asm_out_file)
  915.     fflush (asm_out_file);
  916.   if (aux_info_file)
  917.     fflush (aux_info_file);
  918.   if (rtl_dump_file)
  919.     fflush (rtl_dump_file);
  920.   if (jump_opt_dump_file)
  921.     fflush (jump_opt_dump_file);
  922.   if (cse_dump_file)
  923.     fflush (cse_dump_file);
  924.   if (loop_dump_file)
  925.     fflush (loop_dump_file);
  926.   if (cse2_dump_file)
  927.     fflush (cse2_dump_file);
  928.   if (flow_dump_file)
  929.     fflush (flow_dump_file);
  930.   if (combine_dump_file)
  931.     fflush (combine_dump_file);
  932.   if (sched_dump_file)
  933.     fflush (sched_dump_file);
  934.   if (local_reg_dump_file)
  935.     fflush (local_reg_dump_file);
  936.   if (global_reg_dump_file)
  937.     fflush (global_reg_dump_file);
  938.   if (sched2_dump_file)
  939.     fflush (sched2_dump_file);
  940.   if (jump2_opt_dump_file)
  941.     fflush (jump2_opt_dump_file);
  942.   if (dbr_sched_dump_file)
  943.     fflush (dbr_sched_dump_file);
  944.   if (stack_reg_dump_file)
  945.     fflush (stack_reg_dump_file);
  946.   abort ();
  947. }
  948.  
  949. /* Called to give a better error message when we don't have an insn to match
  950.    what we are looking for or if the insn's constraints aren't satisfied,
  951.    rather than just calling abort().  */
  952.  
  953. void
  954. fatal_insn_not_found (insn)
  955.      rtx insn;
  956. {
  957.   if (INSN_CODE (insn) < 0)
  958.     fatal_insn ("internal error--unrecognizable insn:", insn);
  959.   else
  960.     fatal_insn ("internal error--insn does not satisfy its constraints:", insn);
  961. }
  962.  
  963. /* This is the default decl_printable_name function.  */
  964.  
  965. static char *
  966. decl_name (decl, kind)
  967.      tree decl;
  968.      char **kind;
  969. {
  970.   return IDENTIFIER_POINTER (DECL_NAME (decl));
  971. }
  972.  
  973. /* This is the default interim_eh_hook function.  */
  974.  
  975. void
  976. interim_eh (finalization)
  977.      tree finalization;
  978. {
  979.   /* Don't do anything by default.  */
  980. }
  981.  
  982. static int need_error_newline;
  983.  
  984. /* Function of last error message;
  985.    more generally, function such that if next error message is in it
  986.    then we don't have to mention the function name.  */
  987. static tree last_error_function = NULL;
  988.  
  989. /* Used to detect when input_file_stack has changed since last described.  */
  990. static int last_error_tick;
  991.  
  992. /* Called when the start of a function definition is parsed,
  993.    this function prints on stderr the name of the function.  */
  994.  
  995. void
  996. announce_function (decl)
  997.      tree decl;
  998. {
  999.   if (! quiet_flag)
  1000.     {
  1001.       char *junk;
  1002.       if (rtl_dump_and_exit)
  1003.     fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
  1004.       else
  1005.     fprintf (stderr, " %s", (*decl_printable_name) (decl, &junk));
  1006.       fflush (stderr);
  1007.       need_error_newline = 1;
  1008.       last_error_function = current_function_decl;
  1009.     }
  1010. }
  1011.  
  1012. /* The default function to print out name of current function that caused
  1013.    an error.  */
  1014.  
  1015. void
  1016. default_print_error_function (file)
  1017.      char *file;
  1018. {
  1019.   if (last_error_function != current_function_decl)
  1020.     {
  1021.       char *kind = "function";
  1022.       if (current_function_decl != 0
  1023.       && TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
  1024.     kind = "method";
  1025.  
  1026.       if (file)
  1027.     fprintf (stderr, "%s: ", file);
  1028.  
  1029.       if (current_function_decl == NULL)
  1030.     fprintf (stderr, "At top level:\n");
  1031.       else
  1032.     {
  1033.       char *name = (*decl_printable_name) (current_function_decl, &kind);
  1034.       fprintf (stderr, "In %s `%s':\n", kind, name);
  1035.     }
  1036.  
  1037.       last_error_function = current_function_decl;
  1038.     }
  1039. }
  1040.  
  1041. /* Called by report_error_function to print out function name.
  1042.  * Default may be overridden by language front-ends. */
  1043.  
  1044. void (*print_error_function) PROTO((char*)) = default_print_error_function;
  1045.  
  1046. /* Prints out, if necessary, the name of the current function
  1047.   that caused an error.  Called from all error and warning functions.  */
  1048.  
  1049. void
  1050. report_error_function (file)
  1051.      char *file;
  1052. {
  1053.   struct file_stack *p;
  1054.  
  1055.   if (need_error_newline)
  1056.     {
  1057.       fprintf (stderr, "\n");
  1058.       need_error_newline = 0;
  1059.     }
  1060.  
  1061.   (*print_error_function) (file);
  1062.  
  1063.   if (input_file_stack && input_file_stack->next != 0
  1064.       && input_file_stack_tick != last_error_tick)
  1065.     {
  1066.       fprintf (stderr, "In file included");
  1067.       for (p = input_file_stack->next; p; p = p->next)
  1068.     {
  1069.       fprintf (stderr, " from %s:%d", p->name, p->line);
  1070.       if (p->next)
  1071.         fprintf (stderr, ",\n                ");
  1072.     }
  1073.       fprintf (stderr, ":\n");
  1074.       last_error_tick = input_file_stack_tick;
  1075.     }
  1076. }
  1077.  
  1078. /* Print a message.  */
  1079.  
  1080. static void
  1081. vmessage (prefix, s, ap)
  1082.      char *prefix;
  1083.      char *s;
  1084.      va_list ap;
  1085. {
  1086.   if (prefix)
  1087.     fprintf (stderr, "%s: ", prefix);
  1088.  
  1089. #ifdef HAVE_VPRINTF
  1090.   vfprintf (stderr, s, ap);
  1091. #else
  1092.   {
  1093.     HOST_WIDE_INT v1 = va_arg(ap, HOST_WIDE_INT);
  1094.     HOST_WIDE_INT v2 = va_arg(ap, HOST_WIDE_INT);
  1095.     HOST_WIDE_INT v3 = va_arg(ap, HOST_WIDE_INT);
  1096.     fprintf (stderr, s, v1, v2, v3);
  1097.   }
  1098. #endif
  1099. }
  1100.  
  1101. /* Print a message relevant to line LINE of file FILE.  */
  1102.  
  1103. static void
  1104. v_message_with_file_and_line (file, line, prefix, s, ap)
  1105.      char *file;
  1106.      int line;
  1107.      char *prefix;
  1108.      char *s;
  1109.      va_list ap;
  1110. {
  1111.   if (file)
  1112.     fprintf (stderr, "%s:%d: ", file, line);
  1113.   else
  1114.     fprintf (stderr, "%s: ", progname);
  1115.  
  1116.   vmessage (prefix, s, ap);
  1117.   fputc ('\n', stderr);
  1118. }
  1119.  
  1120. /* Print a message relevant to the given DECL.  */
  1121.  
  1122. static void
  1123. v_message_with_decl (decl, prefix, s, ap)
  1124.      tree decl;
  1125.      char *prefix;
  1126.      char *s;
  1127.      va_list ap;
  1128. {
  1129.   char *n, *p, *junk;
  1130.  
  1131.   fprintf (stderr, "%s:%d: ",
  1132.        DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
  1133.  
  1134.   if (prefix)
  1135.     fprintf (stderr, "%s: ", prefix);
  1136.  
  1137.   /* Do magic to get around lack of varargs support for insertion
  1138.      of arguments into existing list.  We know that the decl is first;
  1139.      we ass_u_me that it will be printed with "%s".  */
  1140.  
  1141.   for (p = s; *p; ++p)
  1142.     {
  1143.       if (*p == '%')
  1144.     {
  1145.       if (*(p + 1) == '%')
  1146.         ++p;
  1147.       else
  1148.         break;
  1149.     }
  1150.     }
  1151.  
  1152.   if (p > s)            /* Print the left-hand substring.  */
  1153.     {
  1154.       char fmt[sizeof "%.255s"];
  1155.       long width = p - s;
  1156.              
  1157.       if (width > 255L) width = 255L;    /* arbitrary */
  1158.       sprintf (fmt, "%%.%lds", width);
  1159.       fprintf (stderr, fmt, s);
  1160.     }
  1161.  
  1162.   if (*p == '%')        /* Print the name.  */
  1163.     {
  1164.       char *n = (DECL_NAME (decl)
  1165.          ? (*decl_printable_name) (decl, &junk)
  1166.          : "((anonymous))");
  1167.       fputs (n, stderr);
  1168.       while (*p)
  1169.     {
  1170.       ++p;
  1171.       if (isalpha (*(p - 1) & 0xFF))
  1172.         break;
  1173.     }
  1174.     }
  1175.  
  1176.   if (*p)            /* Print the rest of the message.  */
  1177.     vmessage ((char *)NULL, p, ap);
  1178.  
  1179.   fputc ('\n', stderr);
  1180. }
  1181.  
  1182. /* Figure file and line of the given INSN.  */
  1183.  
  1184. static void
  1185. file_and_line_for_asm (insn, pfile, pline)
  1186.      rtx insn;
  1187.      char **pfile;
  1188.      int *pline;
  1189. {
  1190.   rtx body = PATTERN (insn);
  1191.   rtx asmop;
  1192.  
  1193.   /* Find the (or one of the) ASM_OPERANDS in the insn.  */
  1194.   if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
  1195.     asmop = SET_SRC (body);
  1196.   else if (GET_CODE (body) == ASM_OPERANDS)
  1197.     asmop = body;
  1198.   else if (GET_CODE (body) == PARALLEL
  1199.        && GET_CODE (XVECEXP (body, 0, 0)) == SET)
  1200.     asmop = SET_SRC (XVECEXP (body, 0, 0));
  1201.   else if (GET_CODE (body) == PARALLEL
  1202.        && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
  1203.     asmop = XVECEXP (body, 0, 0);
  1204.   else
  1205.     asmop = NULL;
  1206.  
  1207.   if (asmop)
  1208.     {
  1209.       *pfile = ASM_OPERANDS_SOURCE_FILE (asmop);
  1210.       *pline = ASM_OPERANDS_SOURCE_LINE (asmop);
  1211.     }
  1212.   else
  1213.     {
  1214.       *pfile = input_filename;
  1215.       *pline = lineno;
  1216.     }
  1217. }
  1218.  
  1219. /* Report an error at line LINE of file FILE.  */
  1220.  
  1221. static void
  1222. v_error_with_file_and_line (file, line, s, ap)
  1223.      char *file;
  1224.      int line;
  1225.      char *s;
  1226.      va_list ap;
  1227. {
  1228.   count_error (0);
  1229.   report_error_function (file);
  1230.   v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
  1231. }
  1232.  
  1233. void
  1234. error_with_file_and_line VPROTO((char *file, int line, char *s, ...))
  1235. {
  1236. #ifndef __STDC__
  1237.   char *file;
  1238.   int line;
  1239.   char *s;
  1240. #endif
  1241.   va_list ap;
  1242.  
  1243.   VA_START (ap, s);
  1244.  
  1245. #ifndef __STDC__
  1246.   file = va_arg (ap, char *);
  1247.   line = va_arg (ap, int);
  1248.   s = va_arg (ap, char *);
  1249. #endif
  1250.  
  1251.   v_error_with_file_and_line (file, line, s, ap);
  1252.   va_end (ap);
  1253. }
  1254.  
  1255. /* Report an error at the declaration DECL.
  1256.    S is a format string which uses %s to substitute the declaration
  1257.    name; subsequent substitutions are a la printf.  */
  1258.  
  1259. static void
  1260. v_error_with_decl (decl, s, ap)
  1261.      tree decl;
  1262.      char *s;
  1263.      va_list ap;
  1264. {
  1265.   count_error (0);
  1266.   report_error_function (DECL_SOURCE_FILE (decl));
  1267.   v_message_with_decl (decl, (char *)NULL, s, ap);
  1268. }
  1269.  
  1270. void
  1271. error_with_decl VPROTO((tree decl, char *s, ...))
  1272. {
  1273. #ifndef __STDC__
  1274.   tree decl;
  1275.   char *s;
  1276. #endif
  1277.   va_list ap;
  1278.  
  1279.   VA_START (ap, s);
  1280.  
  1281. #ifndef __STDC__
  1282.   decl = va_arg (ap, tree);
  1283.   s = va_arg (ap, char *);
  1284. #endif
  1285.  
  1286.   v_error_with_decl (decl, s, ap);
  1287.   va_end (ap);
  1288. }
  1289.  
  1290. /* Report an error at the line number of the insn INSN.
  1291.    This is used only when INSN is an `asm' with operands,
  1292.    and each ASM_OPERANDS records its own source file and line.  */
  1293.  
  1294. static void
  1295. v_error_for_asm (insn, s, ap)
  1296.      rtx insn;
  1297.      char *s;
  1298.      va_list ap;
  1299. {
  1300.   char *file;
  1301.   int line;
  1302.  
  1303.   count_error (0);
  1304.   file_and_line_for_asm (insn, &file, &line);
  1305.   report_error_function (file);
  1306.   v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
  1307. }
  1308.  
  1309. void
  1310. error_for_asm VPROTO((rtx insn, char *s, ...))
  1311. {
  1312. #ifndef __STDC__
  1313.   rtx insn;
  1314.   char *s;
  1315. #endif
  1316.   va_list ap;
  1317.  
  1318.   VA_START (ap, s);
  1319.  
  1320. #ifndef __STDC__
  1321.   insn = va_arg (ap, rtx);
  1322.   s = va_arg (ap, char *);
  1323. #endif
  1324.  
  1325.   v_error_for_asm (insn, s, ap);
  1326.   va_end (ap);
  1327. }
  1328.  
  1329. /* Report an error at the current line number.  */
  1330.  
  1331. static void
  1332. verror (s, ap)
  1333.      char *s;
  1334.      va_list ap;
  1335. {
  1336.   v_error_with_file_and_line (input_filename, lineno, s, ap);
  1337. }
  1338.  
  1339. void
  1340. error VPROTO((char *s, ...))
  1341. {
  1342. #ifndef __STDC__
  1343.   char *s;
  1344. #endif
  1345.   va_list ap;
  1346.  
  1347.   VA_START (ap, s);
  1348.  
  1349. #ifndef __STDC__
  1350.   s = va_arg (ap, char *);
  1351. #endif
  1352.  
  1353.   verror (s, ap);
  1354.   va_end (ap);
  1355. }
  1356.  
  1357. /* Report a fatal error at the current line number.  */
  1358.  
  1359. static void
  1360. vfatal (s, ap)
  1361.      char *s;
  1362.      va_list ap;
  1363. {
  1364.   verror (s, ap);
  1365.   exit (FATAL_EXIT_CODE);
  1366. }
  1367.  
  1368. void
  1369. fatal VPROTO((char *s, ...))
  1370. {
  1371. #ifndef __STDC__
  1372.   char *s;
  1373. #endif
  1374.   va_list ap;
  1375.  
  1376. /* PhB 25-Jun-95: restore old process priority before exiting */
  1377. #ifdef __amigados__
  1378.   SetTaskPri(amiga_task, amiga_old_priority);
  1379. #endif /* __amigados__ */
  1380.  
  1381.   VA_START (ap, s);
  1382.  
  1383. #ifndef __STDC__
  1384.   s = va_arg (ap, char *);
  1385. #endif
  1386.  
  1387.   vfatal (s, ap);
  1388.   va_end (ap);
  1389. }
  1390.  
  1391. /* Report a warning at line LINE of file FILE.  */
  1392.  
  1393. static void
  1394. v_warning_with_file_and_line (file, line, s, ap)
  1395.      char *file;
  1396.      int line;
  1397.      char *s;
  1398.      va_list ap;
  1399. {
  1400.   if (count_error (1))
  1401.     {
  1402.       report_error_function (file);
  1403.       v_message_with_file_and_line (file, line, "warning", s, ap);
  1404.     }
  1405. }
  1406.  
  1407. void
  1408. warning_with_file_and_line VPROTO((char *file, int line, char *s, ...))
  1409. {
  1410. #ifndef __STDC__
  1411.   char *file;
  1412.   int line;
  1413.   char *s;
  1414. #endif
  1415.   va_list ap;
  1416.  
  1417.   VA_START (ap, s);
  1418.  
  1419. #ifndef __STDC__
  1420.   file = va_arg (ap, char *);
  1421.   line = va_arg (ap, int);
  1422.   s = va_arg (ap, char *);
  1423. #endif
  1424.  
  1425.   v_warning_with_file_and_line (file, line, s, ap);
  1426.   va_end (ap);
  1427. }
  1428.  
  1429. /* Report a warning at the declaration DECL.
  1430.    S is a format string which uses %s to substitute the declaration
  1431.    name; subsequent substitutions are a la printf.  */
  1432.  
  1433. static void
  1434. v_warning_with_decl (decl, s, ap)
  1435.      tree decl;
  1436.      char *s;
  1437.      va_list ap;
  1438. {
  1439.   if (count_error (1))
  1440.     {
  1441.       report_error_function (DECL_SOURCE_FILE (decl));
  1442.       v_message_with_decl (decl, "warning", s, ap);
  1443.     }
  1444. }
  1445.  
  1446. void
  1447. warning_with_decl VPROTO((tree decl, char *s, ...))
  1448. {
  1449. #ifndef __STDC__
  1450.   tree decl;
  1451.   char *s;
  1452. #endif
  1453.   va_list ap;
  1454.  
  1455.   VA_START (ap, s);
  1456.  
  1457. #ifndef __STDC__
  1458.   decl = va_arg (ap, tree);
  1459.   s = va_arg (ap, char *);
  1460. #endif
  1461.  
  1462.   v_warning_with_decl (decl, s, ap);
  1463.   va_end (ap);
  1464. }
  1465.  
  1466. /* Report a warning at the line number of the insn INSN.
  1467.    This is used only when INSN is an `asm' with operands,
  1468.    and each ASM_OPERANDS records its own source file and line.  */
  1469.  
  1470. static void
  1471. v_warning_for_asm (insn, s, ap)
  1472.      rtx insn;
  1473.      char *s;
  1474.      va_list ap;
  1475. {
  1476.   if (count_error (1))
  1477.     {
  1478.       char *file;
  1479.       int line;
  1480.  
  1481.       file_and_line_for_asm (insn, &file, &line);
  1482.       report_error_function (file);
  1483.       v_message_with_file_and_line (file, line, "warning", s, ap);
  1484.     }
  1485. }
  1486.  
  1487. void
  1488. warning_for_asm VPROTO((rtx insn, char *s, ...))
  1489. {
  1490. #ifndef __STDC__
  1491.   rtx insn;
  1492.   char *s;
  1493. #endif
  1494.   va_list ap;
  1495.  
  1496.   VA_START (ap, s);
  1497.  
  1498. #ifndef __STDC__
  1499.   insn = va_arg (ap, rtx);
  1500.   s = va_arg (ap, char *);
  1501. #endif
  1502.  
  1503.   v_warning_for_asm (insn, s, ap);
  1504.   va_end (ap);
  1505. }
  1506.  
  1507. /* Report a warning at the current line number.  */
  1508.  
  1509. static void
  1510. vwarning (s, ap)
  1511.      char *s;
  1512.      va_list ap;
  1513. {
  1514.   v_warning_with_file_and_line (input_filename, lineno, s, ap);
  1515. }
  1516.  
  1517. void
  1518. warning VPROTO((char *s, ...))
  1519. {
  1520. #ifndef __STDC__
  1521.   char *s;
  1522. #endif
  1523.   va_list ap;
  1524.  
  1525.   VA_START (ap, s);
  1526.  
  1527. #ifndef __STDC__
  1528.   s = va_arg (ap, char *);
  1529. #endif
  1530.  
  1531.   vwarning (s, ap);
  1532.   va_end (ap);
  1533. }
  1534.  
  1535. /* These functions issue either warnings or errors depending on
  1536.    -pedantic-errors.  */
  1537.  
  1538. static void
  1539. vpedwarn (s, ap)
  1540.      char *s;
  1541.      va_list ap;
  1542. {
  1543.   if (flag_pedantic_errors)
  1544.     verror (s, ap);
  1545.   else
  1546.     vwarning (s, ap);
  1547. }
  1548.  
  1549. void
  1550. pedwarn VPROTO((char *s, ...))
  1551. {
  1552. #ifndef __STDC__
  1553.   char *s;
  1554. #endif
  1555.   va_list ap;
  1556.  
  1557.   VA_START (ap, s);
  1558.  
  1559. #ifndef __STDC__
  1560.   s = va_arg (ap, char *);
  1561. #endif
  1562.  
  1563.   vpedwarn (s, ap);
  1564.   va_end (ap);
  1565. }
  1566.  
  1567. static void
  1568. v_pedwarn_with_decl (decl, s, ap)
  1569.      tree decl;
  1570.      char *s;
  1571.      va_list ap;
  1572. {
  1573.   /* We don't want -pedantic-errors to cause the compilation to fail from
  1574.      "errors" in system header files.  Sometimes fixincludes can't fix what's
  1575.      broken (eg: unsigned char bitfields - fixing it may change the alignment
  1576.      which will cause programs to mysteriously fail because the C library
  1577.      or kernel uses the original layout).  There's no point in issuing a
  1578.      warning either, it's just unnecessary noise.  */
  1579.  
  1580.   if (! DECL_IN_SYSTEM_HEADER (decl))
  1581.     {
  1582.       if (flag_pedantic_errors)
  1583.     v_error_with_decl (decl, s, ap);
  1584.       else
  1585.     v_warning_with_decl (decl, s, ap);
  1586.     }
  1587. }
  1588.  
  1589. void
  1590. pedwarn_with_decl VPROTO((tree decl, char *s, ...))
  1591. {
  1592. #ifndef __STDC__
  1593.   tree decl;
  1594.   char *s;
  1595. #endif
  1596.   va_list ap;
  1597.  
  1598.   VA_START (ap, s);
  1599.  
  1600. #ifndef __STDC__
  1601.   decl = va_arg (ap, tree);
  1602.   s = va_arg (ap, char *);
  1603. #endif
  1604.  
  1605.   v_pedwarn_with_decl (decl, s, ap);
  1606.   va_end (ap);
  1607. }
  1608.  
  1609. static void
  1610. v_pedwarn_with_file_and_line (file, line, s, ap)
  1611.      char *file;
  1612.      int line;
  1613.      char *s;
  1614.      va_list ap;
  1615. {
  1616.   if (flag_pedantic_errors)
  1617.     v_error_with_file_and_line (file, line, s, ap);
  1618.   else
  1619.     v_warning_with_file_and_line (file, line, s, ap);
  1620. }
  1621.  
  1622. void
  1623. pedwarn_with_file_and_line VPROTO((char *file, int line, char *s, ...))
  1624. {
  1625. #ifndef __STDC__
  1626.   char *file;
  1627.   int line;
  1628.   char *s;
  1629. #endif
  1630.   va_list ap;
  1631.  
  1632.   VA_START (ap, s);
  1633.  
  1634. #ifndef __STDC__
  1635.   file = va_arg (ap, char *);
  1636.   line = va_arg (ap, int);
  1637.   s = va_arg (ap, char *);
  1638. #endif
  1639.  
  1640.   v_pedwarn_with_file_and_line (file, line, s, ap);
  1641.   va_end (ap);
  1642. }
  1643.  
  1644. /* Apologize for not implementing some feature.  */
  1645.  
  1646. static void
  1647. vsorry (s, ap)
  1648.      char *s;
  1649.      va_list ap;
  1650. {
  1651.   sorrycount++;
  1652.   if (input_filename)
  1653.     fprintf (stderr, "%s:%d: ", input_filename, lineno);
  1654.   else
  1655.     fprintf (stderr, "%s: ", progname);
  1656.   vmessage ("sorry, not implemented", s, ap);
  1657.   fputc ('\n', stderr);
  1658. }
  1659.  
  1660. void
  1661. sorry VPROTO((char *s, ...))
  1662. {
  1663. #ifndef __STDC__
  1664.   char *s;
  1665. #endif
  1666.   va_list ap;
  1667.  
  1668.   VA_START (ap, s);
  1669.  
  1670. #ifndef __STDC__
  1671.   s = va_arg (ap, char *);
  1672. #endif
  1673.  
  1674.   vsorry (s, ap);
  1675.   va_end (ap);
  1676. }
  1677.  
  1678. /* Apologize for not implementing some feature, then quit.  */
  1679.  
  1680. static void
  1681. v_really_sorry (s, ap)
  1682.      char *s;
  1683.      va_list ap;
  1684. {
  1685.   sorrycount++;
  1686.   if (input_filename)
  1687.     fprintf (stderr, "%s:%d: ", input_filename, lineno);
  1688.   else
  1689.     fprintf (stderr, "%s: ", progname);
  1690.   vmessage ("sorry, not implemented", s, ap);
  1691.   fatal (" (fatal)\n");
  1692. }
  1693.  
  1694. void
  1695. really_sorry VPROTO((char *s, ...))
  1696. {
  1697. #ifndef __STDC__
  1698.   char *s;
  1699. #endif
  1700.   va_list ap;
  1701.  
  1702.   VA_START (ap, s);
  1703.  
  1704. #ifndef __STDC__
  1705.   s = va_arg (ap, char *);
  1706. #endif
  1707.  
  1708.   v_really_sorry (s, ap);
  1709.   va_end (ap);
  1710. }
  1711.  
  1712. /* More 'friendly' abort that prints the line and file.
  1713.    config.h can #define abort fancy_abort if you like that sort of thing.
  1714.  
  1715.    I don't think this is actually a good idea.
  1716.    Other sorts of crashes will look a certain way.
  1717.    It is a good thing if crashes from calling abort look the same way.
  1718.      -- RMS  */
  1719.  
  1720. void
  1721. fancy_abort ()
  1722. {
  1723.   fatal ("internal gcc abort");
  1724. }
  1725.  
  1726. /* This calls abort and is used to avoid problems when abort if a macro.
  1727.    It is used when we need to pass the address of abort.  */
  1728.  
  1729. void
  1730. do_abort ()
  1731. {
  1732.   abort ();
  1733. }
  1734.  
  1735. /* When `malloc.c' is compiled with `rcheck' defined,
  1736.    it calls this function to report clobberage.  */
  1737.  
  1738. void
  1739. botch (s)
  1740. {
  1741.   abort ();
  1742. }
  1743.  
  1744. /* Same as `malloc' but report error if no memory available.  */
  1745.  
  1746. char *
  1747. xmalloc (size)
  1748.      unsigned size;
  1749. {
  1750.   register char *value = (char *) malloc (size);
  1751.   if (value == 0)
  1752.     fatal ("virtual memory exhausted");
  1753.   return value;
  1754. }
  1755.  
  1756. /* Same as `realloc' but report error if no memory available.  */
  1757.  
  1758. char *
  1759. xrealloc (ptr, size)
  1760.      char *ptr;
  1761.      int size;
  1762. {
  1763.   char *result = (char *) realloc (ptr, size);
  1764.   if (!result)
  1765.     fatal ("virtual memory exhausted");
  1766.   return result;
  1767. }
  1768.  
  1769. /* Return the logarithm of X, base 2, considering X unsigned,
  1770.    if X is a power of 2.  Otherwise, returns -1.
  1771.  
  1772.    This should be used via the `exact_log2' macro.  */
  1773.  
  1774. int
  1775. exact_log2_wide (x)
  1776.      register unsigned HOST_WIDE_INT x;
  1777. {
  1778.   register int log = 0;
  1779.   /* Test for 0 or a power of 2.  */
  1780.   if (x == 0 || x != (x & -x))
  1781.     return -1;
  1782.   while ((x >>= 1) != 0)
  1783.     log++;
  1784.   return log;
  1785. }
  1786.  
  1787. /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
  1788.    If X is 0, return -1.
  1789.  
  1790.    This should be used via the floor_log2 macro.  */
  1791.  
  1792. int
  1793. floor_log2_wide (x)
  1794.      register unsigned HOST_WIDE_INT x;
  1795. {
  1796.   register int log = -1;
  1797.   while (x != 0)
  1798.     log++,
  1799.     x >>= 1;
  1800.   return log;
  1801. }
  1802.  
  1803. int float_handled;
  1804. jmp_buf float_handler;
  1805.  
  1806. /* Specify where to longjmp to when a floating arithmetic error happens.
  1807.    If HANDLER is 0, it means don't handle the errors any more.  */
  1808.  
  1809. void
  1810. set_float_handler (handler)
  1811.      jmp_buf handler;
  1812. {
  1813.   float_handled = (handler != 0);
  1814.   if (handler)
  1815.     bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
  1816. }
  1817.  
  1818. /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
  1819.    error happens, pushing the previous specification into OLD_HANDLER.
  1820.    Return an indication of whether there was a previous handler in effect.  */
  1821.  
  1822. int
  1823. push_float_handler (handler, old_handler)
  1824.      jmp_buf handler, old_handler;
  1825. {
  1826.   int was_handled = float_handled;
  1827.  
  1828.   float_handled = 1;
  1829.   if (was_handled)
  1830.     bcopy ((char *) float_handler, (char *) old_handler,
  1831.        sizeof (float_handler));
  1832.  
  1833.   bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
  1834.   return was_handled;
  1835. }
  1836.  
  1837. /* Restore the previous specification of whether and where to longjmp to
  1838.    when a floating arithmetic error happens.  */
  1839.  
  1840. void
  1841. pop_float_handler (handled, handler)
  1842.      int handled;
  1843.      jmp_buf handler;
  1844. {
  1845.   float_handled = handled;
  1846.   if (handled)
  1847.     bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
  1848. }
  1849.  
  1850. /* Signals actually come here.  */
  1851.  
  1852. static void
  1853. float_signal (signo)
  1854.      /* If this is missing, some compilers complain.  */
  1855.      int signo;
  1856. {
  1857.   if (float_handled == 0)
  1858.     abort ();
  1859. #if defined (USG) || defined (hpux)
  1860.   signal (SIGFPE, float_signal);  /* re-enable the signal catcher */
  1861. #endif
  1862.   float_handled = 0;
  1863.   signal (SIGFPE, float_signal);
  1864.   longjmp (float_handler, 1);
  1865. }
  1866.  
  1867. /* Handler for SIGPIPE.  */
  1868.  
  1869. static void
  1870. pipe_closed (signo)
  1871.      /* If this is missing, some compilers complain.  */
  1872.      int signo;
  1873. {
  1874.   fatal ("output pipe has been closed");
  1875. }
  1876.  
  1877. /* Strip off a legitimate source ending from the input string NAME of
  1878.    length LEN. */
  1879.  
  1880. void
  1881. strip_off_ending (name, len)
  1882.      char *name;
  1883.      int len;
  1884. {
  1885.   if (len > 2 && ! strcmp (".c", name + len - 2))
  1886.     name[len - 2] = 0;
  1887.   else if (len > 2 && ! strcmp (".m", name + len - 2))
  1888.     name[len - 2] = 0;
  1889.   else if (len > 2 && ! strcmp (".i", name + len - 2))
  1890.     name[len - 2] = 0;
  1891.   else if (len > 3 && ! strcmp (".ii", name + len - 3))
  1892.     name[len - 3] = 0;
  1893.   else if (len > 3 && ! strcmp (".co", name + len - 3))
  1894.     name[len - 3] = 0;
  1895.   else if (len > 3 && ! strcmp (".cc", name + len - 3))
  1896.     name[len - 3] = 0;
  1897.   else if (len > 2 && ! strcmp (".C", name + len - 2))
  1898.     name[len - 2] = 0;
  1899.   else if (len > 4 && ! strcmp (".cxx", name + len - 4))
  1900.     name[len - 4] = 0;
  1901.   else if (len > 4 && ! strcmp (".cpp", name + len - 4))
  1902.     name[len - 4] = 0;
  1903.   else if (len > 2 && ! strcmp (".f", name + len - 2))
  1904.     name[len - 2] = 0;
  1905.   /* Ada will use extensions like .ada, .adb, and .ads, so just test
  1906.      for "ad".  */
  1907.   else if (len > 4 && ! strncmp (".ad", name + len - 4, 3))
  1908.     name[len - 4] = 0;
  1909.   else if (len > 4 && ! strcmp (".atr", name + len - 4))
  1910.     name[len - 4] = 0;
  1911. }
  1912.  
  1913. /* Output a quoted string.  */
  1914. void
  1915. output_quoted_string (asm_file, string)
  1916.      FILE *asm_file;
  1917.      char *string;
  1918. {
  1919.   char c;
  1920.  
  1921.   putc ('\"', asm_file);
  1922.   while ((c = *string++) != 0)
  1923.     {
  1924.       if (c == '\"' || c == '\\')
  1925.     putc ('\\', asm_file);
  1926.       putc (c, asm_file);
  1927.     }
  1928.   putc ('\"', asm_file);
  1929. }
  1930.  
  1931. /* Output a file name in the form wanted by System V.  */
  1932.  
  1933. void
  1934. output_file_directive (asm_file, input_name)
  1935.      FILE *asm_file;
  1936.      char *input_name;
  1937. {
  1938. #ifdef FILE_NAME_NONDIRECTORY
  1939.   char *na = FILE_NAME_NONDIRECTORY (input_name);
  1940. #else
  1941.   int len = strlen (input_name);
  1942.   char *na = input_name + len;
  1943.  
  1944.   /* NA gets INPUT_NAME sans directory names.  */
  1945.   while (na > input_name)
  1946.     {
  1947.       if (na[-1] == '/')
  1948.     break;
  1949.       na--;
  1950.     }
  1951. #endif
  1952.  
  1953. #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
  1954.   ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
  1955. #else
  1956. #ifdef ASM_OUTPUT_SOURCE_FILENAME
  1957.   ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
  1958. #else
  1959.   fprintf (asm_file, "\t.file\t");
  1960.   output_quoted_string (asm_file, na);
  1961.   fputc ('\n', asm_file);
  1962. #endif
  1963. #endif
  1964. }
  1965.  
  1966. /* Routine to build language identifier for object file. */
  1967. static void
  1968. output_lang_identify (asm_out_file)
  1969.      FILE *asm_out_file;
  1970. {
  1971.   int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
  1972.   char *s = (char *) alloca (len);
  1973.   sprintf (s, "__gnu_compiled_%s", lang_identify ());
  1974.   ASM_OUTPUT_LABEL (asm_out_file, s);
  1975. }
  1976.  
  1977. /* Routine to open a dump file.  */
  1978. static FILE *
  1979. open_dump_file (base_name, suffix)
  1980.      char *base_name;
  1981.      char *suffix;
  1982. {
  1983.   FILE *f;
  1984.   char *dumpname = (char *) alloca (strlen (base_name) + strlen (suffix) + 1);
  1985.  
  1986.   strcpy (dumpname, base_name);
  1987.   strcat (dumpname, suffix);
  1988.   f = fopen (dumpname, "w");
  1989.   if (f == 0)
  1990.     pfatal_with_name (dumpname);
  1991.   return f;
  1992. }
  1993.  
  1994. /* Compile an entire file of output from cpp, named NAME.
  1995.    Write a file of assembly output and various debugging dumps.  */
  1996.  
  1997. static void
  1998. compile_file (name)
  1999.      char *name;
  2000. {
  2001.   tree globals;
  2002.   int start_time;
  2003.  
  2004.   int name_specified = name != 0;
  2005.  
  2006.   if (dump_base_name == 0)
  2007.     dump_base_name = name ? name : "gccdump";
  2008.  
  2009.   parse_time = 0;
  2010.   varconst_time = 0;
  2011.   integration_time = 0;
  2012.   jump_time = 0;
  2013.   cse_time = 0;
  2014.   loop_time = 0;
  2015.   cse2_time = 0;
  2016.   flow_time = 0;
  2017.   combine_time = 0;
  2018.   sched_time = 0;
  2019.   local_alloc_time = 0;
  2020.   global_alloc_time = 0;
  2021.   sched2_time = 0;
  2022.   dbr_sched_time = 0;
  2023.   shorten_branch_time = 0;
  2024.   stack_reg_time = 0;
  2025.   final_time = 0;
  2026.   symout_time = 0;
  2027.   dump_time = 0;
  2028.  
  2029.   /* Open input file.  */
  2030.  
  2031.   if (name == 0 || !strcmp (name, "-"))
  2032.     {
  2033.       finput = stdin;
  2034.       name = "stdin";
  2035.     }
  2036.   else
  2037.     finput = fopen (name, "r");
  2038.   if (finput == 0)
  2039.     pfatal_with_name (name);
  2040.  
  2041. #ifdef IO_BUFFER_SIZE
  2042.   setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
  2043. #endif
  2044.  
  2045.   /* Initialize data in various passes.  */
  2046.  
  2047.   init_obstacks ();
  2048.   init_tree_codes ();
  2049.   init_lex ();
  2050.   /* Some of these really don't need to be called when generating bytecode,
  2051.      but the options would have to be parsed first to know that. -bson */
  2052.   init_rtl ();
  2053.   init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
  2054.           || debug_info_level == DINFO_LEVEL_VERBOSE);
  2055.   init_regs ();
  2056.   init_decl_processing ();
  2057.   init_optabs ();
  2058.   init_stmt ();
  2059.   init_expmed ();
  2060.   init_expr_once ();
  2061.   init_loop ();
  2062.   init_reload ();
  2063.  
  2064.   if (flag_caller_saves)
  2065.     init_caller_save ();
  2066.  
  2067.   /* If auxiliary info generation is desired, open the output file.
  2068.      This goes in the same directory as the source file--unlike
  2069.      all the other output files.  */
  2070.   if (flag_gen_aux_info)
  2071.     {
  2072.       aux_info_file = fopen (aux_info_file_name, "w");
  2073.       if (aux_info_file == 0)
  2074.     pfatal_with_name (aux_info_file_name);
  2075.     }
  2076.  
  2077.   /* If rtl dump desired, open the output file.  */
  2078.   if (rtl_dump)
  2079.     rtl_dump_file = open_dump_file (dump_base_name, ".rtl");
  2080.  
  2081.   /* If jump_opt dump desired, open the output file.  */
  2082.   if (jump_opt_dump)
  2083.     jump_opt_dump_file = open_dump_file (dump_base_name, ".jump");
  2084.  
  2085.   /* If cse dump desired, open the output file.  */
  2086.   if (cse_dump)
  2087.     cse_dump_file = open_dump_file (dump_base_name, ".cse");
  2088.  
  2089.   /* If loop dump desired, open the output file.  */
  2090.   if (loop_dump)
  2091.     loop_dump_file = open_dump_file (dump_base_name, ".loop");
  2092.  
  2093.   /* If cse2 dump desired, open the output file.  */
  2094.   if (cse2_dump)
  2095.     cse2_dump_file = open_dump_file (dump_base_name, ".cse2");
  2096.  
  2097.   /* If flow dump desired, open the output file.  */
  2098.   if (flow_dump)
  2099.     flow_dump_file = open_dump_file (dump_base_name, ".flow");
  2100.  
  2101.   /* If combine dump desired, open the output file.  */
  2102.   if (combine_dump)
  2103.     combine_dump_file = open_dump_file (dump_base_name, ".combine");
  2104.  
  2105.   /* If scheduling dump desired, open the output file.  */
  2106.   if (sched_dump)
  2107.     sched_dump_file = open_dump_file (dump_base_name, ".sched");
  2108.  
  2109.   /* If local_reg dump desired, open the output file.  */
  2110.   if (local_reg_dump)
  2111.     local_reg_dump_file = open_dump_file (dump_base_name, ".lreg");
  2112.  
  2113.   /* If global_reg dump desired, open the output file.  */
  2114.   if (global_reg_dump)
  2115.     global_reg_dump_file = open_dump_file (dump_base_name, ".greg");
  2116.  
  2117.   /* If 2nd scheduling dump desired, open the output file.  */
  2118.   if (sched2_dump)
  2119.     sched2_dump_file = open_dump_file (dump_base_name, ".sched2");
  2120.  
  2121.   /* If jump2_opt dump desired, open the output file.  */
  2122.   if (jump2_opt_dump)
  2123.     jump2_opt_dump_file = open_dump_file (dump_base_name, ".jump2");
  2124.  
  2125.   /* If dbr_sched dump desired, open the output file.  */
  2126.   if (dbr_sched_dump)
  2127.     dbr_sched_dump_file = open_dump_file (dump_base_name, ".dbr");
  2128.  
  2129. #ifdef STACK_REGS
  2130.  
  2131.   /* If stack_reg dump desired, open the output file.  */
  2132.   if (stack_reg_dump)
  2133.     stack_reg_dump_file = open_dump_file (dump_base_name, ".stack");
  2134.  
  2135. #endif
  2136.  
  2137.   /* Open assembler code output file.  */
  2138.  
  2139.   if (! name_specified && asm_file_name == 0)
  2140.     asm_out_file = stdout;
  2141.   else
  2142.     {
  2143.       int len = strlen (dump_base_name);
  2144.       register char *dumpname = (char *) xmalloc (len + 6);
  2145.       strcpy (dumpname, dump_base_name);
  2146.       strip_off_ending (dumpname, len);
  2147.       strcat (dumpname, ".s");
  2148.       if (asm_file_name == 0)
  2149.     {
  2150.       asm_file_name = (char *) xmalloc (strlen (dumpname) + 1);
  2151.       strcpy (asm_file_name, dumpname);
  2152.     }
  2153.       if (!strcmp (asm_file_name, "-"))
  2154.     asm_out_file = stdout;
  2155.       else
  2156.     asm_out_file = fopen (asm_file_name, "w");
  2157.       if (asm_out_file == 0)
  2158.     pfatal_with_name (asm_file_name);
  2159.     }
  2160.  
  2161. #ifdef IO_BUFFER_SIZE
  2162.   setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
  2163.        _IOFBF, IO_BUFFER_SIZE);
  2164. #endif
  2165.  
  2166.   input_filename = name;
  2167.  
  2168.   /* Put an entry on the input file stack for the main input file.  */
  2169.   input_file_stack
  2170.     = (struct file_stack *) xmalloc (sizeof (struct file_stack));
  2171.   input_file_stack->next = 0;
  2172.   input_file_stack->name = input_filename;
  2173.  
  2174.   /* Perform language-specific initialization.
  2175.      This may set main_input_filename.  */
  2176.   lang_init ();
  2177.  
  2178.   /* If the input doesn't start with a #line, use the input name
  2179.      as the official input file name.  */
  2180.   if (main_input_filename == 0)
  2181.     main_input_filename = name;
  2182.  
  2183.   if (!output_bytecode)
  2184.     {
  2185.       ASM_FILE_START (asm_out_file);
  2186.     }
  2187.  
  2188.   /* Output something to inform GDB that this compilation was by GCC.  Also
  2189.      serves to tell GDB file consists of bytecodes. */
  2190.   if (output_bytecode)
  2191.     fprintf (asm_out_file, "bc_gcc2_compiled.:\n");
  2192.   else
  2193.     {
  2194. #ifndef ASM_IDENTIFY_GCC
  2195.       fprintf (asm_out_file, "gcc2_compiled.:\n");
  2196. #else
  2197.       ASM_IDENTIFY_GCC (asm_out_file);
  2198. #endif
  2199.     }
  2200.  
  2201.   /* Output something to identify which front-end produced this file. */
  2202. #ifdef ASM_IDENTIFY_LANGUAGE
  2203.   ASM_IDENTIFY_LANGUAGE (asm_out_file);
  2204. #endif
  2205.  
  2206.   if (output_bytecode)
  2207.     {
  2208.       if (profile_flag || profile_block_flag)
  2209.     error ("profiling not supported in bytecode compilation");
  2210.     }
  2211.   else
  2212.     {
  2213.       /* ??? Note: There used to be a conditional here
  2214.      to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
  2215.      This was to guarantee separation between gcc_compiled. and
  2216.      the first function, for the sake of dbx on Suns.
  2217.      However, having the extra zero here confused the Emacs
  2218.      code for unexec, and might confuse other programs too.
  2219.      Therefore, I took out that change.
  2220.      In future versions we should find another way to solve
  2221.      that dbx problem.  -- rms, 23 May 93.  */
  2222.       
  2223.       /* Don't let the first function fall at the same address
  2224.      as gcc_compiled., if profiling.  */
  2225.       if (profile_flag || profile_block_flag)
  2226.     assemble_zeros (UNITS_PER_WORD);
  2227.     }
  2228.  
  2229.   /* If dbx symbol table desired, initialize writing it
  2230.      and output the predefined types.  */
  2231. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2232.   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2233.     TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
  2234.                        getdecls ()));
  2235. #endif
  2236. #ifdef SDB_DEBUGGING_INFO
  2237.   if (write_symbols == SDB_DEBUG)
  2238.     TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
  2239.                        getdecls ()));
  2240. #endif
  2241. #ifdef DWARF_DEBUGGING_INFO
  2242.   if (write_symbols == DWARF_DEBUG)
  2243.     TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
  2244. #endif
  2245.  
  2246.   /* Initialize yet another pass.  */
  2247.  
  2248.   if (!output_bytecode)
  2249.     init_final (main_input_filename);
  2250.  
  2251.   start_time = get_run_time ();
  2252.  
  2253.   /* Call the parser, which parses the entire file
  2254.      (calling rest_of_compilation for each function).  */
  2255.  
  2256.   if (yyparse () != 0)
  2257.     {
  2258.       if (errorcount == 0)
  2259.     fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
  2260.  
  2261.       /* In case there were missing closebraces,
  2262.      get us back to the global binding level.  */
  2263.       while (! global_bindings_p ())
  2264.     poplevel (0, 0, 0);
  2265.     }
  2266.  
  2267.   /* Compilation is now finished except for writing
  2268.      what's left of the symbol table output.  */
  2269.  
  2270.   parse_time += get_run_time () - start_time;
  2271.  
  2272.   parse_time -= integration_time;
  2273.   parse_time -= varconst_time;
  2274.  
  2275.   globals = getdecls ();
  2276.  
  2277.   /* Really define vars that have had only a tentative definition.
  2278.      Really output inline functions that must actually be callable
  2279.      and have not been output so far.  */
  2280.  
  2281.   {
  2282.     int len = list_length (globals);
  2283.     tree *vec = (tree *) alloca (sizeof (tree) * len);
  2284.     int i;
  2285.     tree decl;
  2286.     int reconsider = 1;
  2287.  
  2288.     /* Process the decls in reverse order--earliest first.
  2289.        Put them into VEC from back to front, then take out from front.  */
  2290.  
  2291.     for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
  2292.       vec[len - i - 1] = decl;
  2293.  
  2294.     for (i = 0; i < len; i++)
  2295.       {
  2296.     decl = vec[i];
  2297.  
  2298.     /* We're not deferring this any longer.  */
  2299.     DECL_DEFER_OUTPUT (decl) = 0;
  2300.  
  2301.     if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
  2302.         && incomplete_decl_finalize_hook != 0)
  2303.       (*incomplete_decl_finalize_hook) (decl);
  2304.       }
  2305.  
  2306.     /* Now emit any global variables or functions that we have been putting
  2307.        off.  We need to loop in case one of the things emitted here
  2308.        references another one which comes earlier in the list.  */
  2309.     while (reconsider)
  2310.       {
  2311.     reconsider = 0;
  2312.     for (i = 0; i < len; i++)
  2313.       {
  2314.         decl = vec[i];
  2315.  
  2316.         if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
  2317.           continue;
  2318.  
  2319.         /* Don't write out static consts, unless we still need them.
  2320.  
  2321.            We also keep static consts if not optimizing (for debugging).
  2322.            ??? They might be better written into the debug information.
  2323.            This is possible when using DWARF.
  2324.  
  2325.            A language processor that wants static constants to be always
  2326.            written out (even if it is not used) is responsible for
  2327.            calling rest_of_decl_compilation itself.  E.g. the C front-end
  2328.            calls rest_of_decl_compilation from finish_decl.
  2329.            One motivation for this is that is conventional in some
  2330.            environments to write things like:
  2331.                static const char rcsid[] = "... version string ...";
  2332.            intending to force the string to be in the executable.
  2333.  
  2334.            A language processor that would prefer to have unneeded
  2335.            static constants "optimized away" would just defer writing
  2336.            them out until here.  E.g. C++ does this, because static
  2337.            constants are often defined in header files.
  2338.  
  2339.            ??? A tempting alternative (for both C and C++) would be
  2340.            to force a constant to be written if and only if it is
  2341.            defined in a main file, as opposed to an include file. */
  2342.  
  2343.         if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
  2344.         && (! TREE_READONLY (decl)
  2345.             || TREE_PUBLIC (decl)
  2346.             || !optimize
  2347.             || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
  2348.           {
  2349.         reconsider = 1;
  2350.         rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
  2351.           }
  2352.  
  2353.         if (TREE_CODE (decl) == FUNCTION_DECL
  2354.         && DECL_INITIAL (decl) != 0
  2355.         && DECL_SAVED_INSNS (decl) != 0
  2356.         && (flag_keep_inline_functions
  2357.             || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
  2358.           {
  2359.         reconsider = 1;
  2360.         temporary_allocation ();
  2361.         output_inline_function (decl);
  2362.         permanent_allocation (1);
  2363.           }
  2364.       }
  2365.       }
  2366.  
  2367.     for (i = 0; i < len; i++)
  2368.       {
  2369.     decl = vec[i];
  2370.  
  2371.     if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
  2372.         && ! TREE_ASM_WRITTEN (decl))
  2373.       /* Cancel the RTL for this decl so that, if debugging info
  2374.          output for global variables is still to come,
  2375.          this one will be omitted.  */
  2376.       DECL_RTL (decl) = NULL;
  2377.  
  2378.     /* Warn about any function
  2379.        declared static but not defined.
  2380.        We don't warn about variables,
  2381.        because many programs have static variables
  2382.        that exist only to get some text into the object file.  */
  2383.     if (TREE_CODE (decl) == FUNCTION_DECL
  2384.         && (warn_unused
  2385.         || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
  2386.         && DECL_INITIAL (decl) == 0
  2387.         && DECL_EXTERNAL (decl)
  2388.         && ! TREE_PUBLIC (decl))
  2389.       {
  2390.         pedwarn_with_decl (decl, 
  2391.                    "`%s' declared `static' but never defined");
  2392.         /* This symbol is effectively an "extern" declaration now.  */
  2393.         TREE_PUBLIC (decl) = 1;
  2394.         assemble_external (decl);
  2395.       }
  2396.  
  2397.     /* Warn about static fns or vars defined but not used,
  2398.        but not about inline functions or static consts
  2399.        since defining those in header files is normal practice.  */
  2400.     if (warn_unused
  2401.         && ((TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
  2402.         || (TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
  2403.         && ! DECL_IN_SYSTEM_HEADER (decl)
  2404.         && ! DECL_EXTERNAL (decl)
  2405.         && ! TREE_PUBLIC (decl)
  2406.         && ! TREE_USED (decl)
  2407.         && ! DECL_REGISTER (decl)
  2408.         /* The TREE_USED bit for file-scope decls
  2409.            is kept in the identifier, to handle multiple
  2410.            external decls in different scopes.  */
  2411.         && ! TREE_USED (DECL_NAME (decl)))
  2412.       warning_with_decl (decl, "`%s' defined but not used");
  2413.  
  2414. #ifdef SDB_DEBUGGING_INFO
  2415.     /* The COFF linker can move initialized global vars to the end.
  2416.        And that can screw up the symbol ordering.
  2417.        By putting the symbols in that order to begin with,
  2418.        we avoid a problem.  mcsun!unido!fauern!tumuc!pes@uunet.uu.net.  */
  2419.     if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
  2420.         && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
  2421.         && ! DECL_EXTERNAL (decl)
  2422.         && DECL_RTL (decl) != 0)
  2423.       TIMEVAR (symout_time, sdbout_symbol (decl, 0));
  2424.  
  2425.     /* Output COFF information for non-global
  2426.        file-scope initialized variables. */
  2427.     if (write_symbols == SDB_DEBUG
  2428.         && TREE_CODE (decl) == VAR_DECL
  2429.         && DECL_INITIAL (decl)
  2430.         && ! DECL_EXTERNAL (decl)
  2431.         && DECL_RTL (decl) != 0
  2432.         && GET_CODE (DECL_RTL (decl)) == MEM)
  2433.       TIMEVAR (symout_time, sdbout_toplevel_data (decl));
  2434. #endif /* SDB_DEBUGGING_INFO */
  2435. #ifdef DWARF_DEBUGGING_INFO
  2436.     /* Output DWARF information for file-scope tentative data object
  2437.        declarations, file-scope (extern) function declarations (which
  2438.        had no corresponding body) and file-scope tagged type declarations
  2439.        and definitions which have not yet been forced out.  */
  2440.  
  2441.     if (write_symbols == DWARF_DEBUG
  2442.         && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
  2443.       TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
  2444. #endif
  2445.       }
  2446.   }
  2447.  
  2448.   /* Write out any pending weak symbol declarations.  */
  2449.  
  2450.   weak_finish ();
  2451.  
  2452.   /* Do dbx symbols */
  2453. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2454.   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2455.     TIMEVAR (symout_time,
  2456.          {
  2457.            dbxout_finish (asm_out_file, main_input_filename);
  2458.          });
  2459. #endif
  2460.  
  2461. #ifdef DWARF_DEBUGGING_INFO
  2462.   if (write_symbols == DWARF_DEBUG)
  2463.     TIMEVAR (symout_time,
  2464.          {
  2465.            dwarfout_finish ();
  2466.          });
  2467. #endif
  2468.  
  2469.   /* Output some stuff at end of file if nec.  */
  2470.  
  2471.   if (!output_bytecode)
  2472.     {
  2473.       end_final (main_input_filename);
  2474.  
  2475. #ifdef ASM_FILE_END
  2476.       ASM_FILE_END (asm_out_file);
  2477. #endif
  2478.     }
  2479.  
  2480.   /* Language-specific end of compilation actions.  */
  2481.  
  2482.   lang_finish ();
  2483.  
  2484.   if (output_bytecode)
  2485.     bc_write_file (asm_out_file);
  2486.  
  2487.   /* Close the dump files.  */
  2488.  
  2489.   if (flag_gen_aux_info)
  2490.     {
  2491.       fclose (aux_info_file);
  2492.       if (errorcount)
  2493.     unlink (aux_info_file_name);
  2494.     }
  2495.  
  2496.   if (rtl_dump)
  2497.     fclose (rtl_dump_file);
  2498.  
  2499.   if (jump_opt_dump)
  2500.     fclose (jump_opt_dump_file);
  2501.  
  2502.   if (cse_dump)
  2503.     fclose (cse_dump_file);
  2504.  
  2505.   if (loop_dump)
  2506.     fclose (loop_dump_file);
  2507.  
  2508.   if (cse2_dump)
  2509.     fclose (cse2_dump_file);
  2510.  
  2511.   if (flow_dump)
  2512.     fclose (flow_dump_file);
  2513.  
  2514.   if (combine_dump)
  2515.     {
  2516.       dump_combine_total_stats (combine_dump_file);
  2517.       fclose (combine_dump_file);
  2518.     }
  2519.  
  2520.   if (sched_dump)
  2521.     fclose (sched_dump_file);
  2522.  
  2523.   if (local_reg_dump)
  2524.     fclose (local_reg_dump_file);
  2525.  
  2526.   if (global_reg_dump)
  2527.     fclose (global_reg_dump_file);
  2528.  
  2529.   if (sched2_dump)
  2530.     fclose (sched2_dump_file);
  2531.  
  2532.   if (jump2_opt_dump)
  2533.     fclose (jump2_opt_dump_file);
  2534.  
  2535.   if (dbr_sched_dump)
  2536.     fclose (dbr_sched_dump_file);
  2537.  
  2538. #ifdef STACK_REGS
  2539.   if (stack_reg_dump)
  2540.     fclose (stack_reg_dump_file);
  2541. #endif
  2542.  
  2543.   /* Close non-debugging input and output files.  Take special care to note
  2544.      whether fclose returns an error, since the pages might still be on the
  2545.      buffer chain while the file is open.  */
  2546.  
  2547.   fclose (finput);
  2548.   if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
  2549.     fatal_io_error (asm_file_name);
  2550.  
  2551.   /* Print the times.  */
  2552.  
  2553.   if (! quiet_flag)
  2554.     {
  2555.       fprintf (stderr,"\n");
  2556.       print_time ("parse", parse_time);
  2557.  
  2558.       if (!output_bytecode)
  2559.     {
  2560.       print_time ("integration", integration_time);
  2561.       print_time ("jump", jump_time);
  2562.       print_time ("cse", cse_time);
  2563.       print_time ("loop", loop_time);
  2564.       print_time ("cse2", cse2_time);
  2565.       print_time ("flow", flow_time);
  2566.       print_time ("combine", combine_time);
  2567.       print_time ("sched", sched_time);
  2568.       print_time ("local-alloc", local_alloc_time);
  2569.       print_time ("global-alloc", global_alloc_time);
  2570.       print_time ("sched2", sched2_time);
  2571.       print_time ("dbranch", dbr_sched_time);
  2572.       print_time ("shorten-branch", shorten_branch_time);
  2573.       print_time ("stack-reg", stack_reg_time);
  2574.       print_time ("final", final_time);
  2575.       print_time ("varconst", varconst_time);
  2576.       print_time ("symout", symout_time);
  2577.       print_time ("dump", dump_time);
  2578.     }
  2579.     }
  2580. }
  2581.  
  2582. /* This is called from various places for FUNCTION_DECL, VAR_DECL,
  2583.    and TYPE_DECL nodes.
  2584.  
  2585.    This does nothing for local (non-static) variables.
  2586.    Otherwise, it sets up the RTL and outputs any assembler code
  2587.    (label definition, storage allocation and initialization).
  2588.  
  2589.    DECL is the declaration.  If ASMSPEC is nonzero, it specifies
  2590.    the assembler symbol name to be used.  TOP_LEVEL is nonzero
  2591.    if this declaration is not within a function.  */
  2592.  
  2593. void
  2594. rest_of_decl_compilation (decl, asmspec, top_level, at_end)
  2595.      tree decl;
  2596.      char *asmspec;
  2597.      int top_level;
  2598.      int at_end;
  2599. {
  2600.   /* Declarations of variables, and of functions defined elsewhere.  */
  2601.  
  2602. /* The most obvious approach, to put an #ifndef around where
  2603.    this macro is used, doesn't work since it's inside a macro call.  */
  2604. #ifndef ASM_FINISH_DECLARE_OBJECT
  2605. #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
  2606. #endif
  2607.  
  2608.   /* Forward declarations for nested functions are not "external",
  2609.      but we need to treat them as if they were.  */
  2610.   if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
  2611.       || TREE_CODE (decl) == FUNCTION_DECL)
  2612.     TIMEVAR (varconst_time,
  2613.          {
  2614.            make_decl_rtl (decl, asmspec, top_level);
  2615.            /* Initialized extern variable exists to be replaced
  2616.           with its value, or represents something that will be
  2617.           output in another file.  */
  2618.            if (! (TREE_CODE (decl) == VAR_DECL
  2619.               && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
  2620.               && DECL_INITIAL (decl) != 0
  2621.               && DECL_INITIAL (decl) != error_mark_node))
  2622.          /* Don't output anything
  2623.             when a tentative file-scope definition is seen.
  2624.             But at end of compilation, do output code for them.  */
  2625.          if (! (! at_end && top_level
  2626.             && (DECL_INITIAL (decl) == 0
  2627.                 || DECL_INITIAL (decl) == error_mark_node)))
  2628.            assemble_variable (decl, top_level, at_end, 0);
  2629.            if (decl == last_assemble_variable_decl)
  2630.          {
  2631.            ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
  2632.                           top_level, at_end);
  2633.          }
  2634.          });
  2635.   else if (DECL_REGISTER (decl) && asmspec != 0)
  2636.     {
  2637.       if (decode_reg_name (asmspec) >= 0)
  2638.     {
  2639.       DECL_RTL (decl) = 0;
  2640.       make_decl_rtl (decl, asmspec, top_level);
  2641.     }
  2642.       else
  2643.     error ("invalid register name `%s' for register variable", asmspec);
  2644.     }
  2645. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2646.   else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2647.        && TREE_CODE (decl) == TYPE_DECL)
  2648.     TIMEVAR (symout_time, dbxout_symbol (decl, 0));
  2649. #endif
  2650. #ifdef SDB_DEBUGGING_INFO
  2651.   else if (write_symbols == SDB_DEBUG && top_level
  2652.        && TREE_CODE (decl) == TYPE_DECL)
  2653.     TIMEVAR (symout_time, sdbout_symbol (decl, 0));
  2654. #endif
  2655. }
  2656.  
  2657. /* Called after finishing a record, union or enumeral type.  */
  2658.  
  2659. void
  2660. rest_of_type_compilation (type, toplev)
  2661.      tree type;
  2662.      int toplev;
  2663. {
  2664. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2665.   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2666.     TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
  2667. #endif
  2668. #ifdef SDB_DEBUGGING_INFO
  2669.   if (write_symbols == SDB_DEBUG)
  2670.     TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
  2671. #endif
  2672. }
  2673.  
  2674. /* This is called from finish_function (within yyparse)
  2675.    after each top-level definition is parsed.
  2676.    It is supposed to compile that function or variable
  2677.    and output the assembler code for it.
  2678.    After we return, the tree storage is freed.  */
  2679.  
  2680. void
  2681. rest_of_compilation (decl)
  2682.      tree decl;
  2683. {
  2684.   register rtx insns;
  2685.   int start_time = get_run_time ();
  2686.   int tem;
  2687.   /* Nonzero if we have saved the original DECL_INITIAL of the function,
  2688.      to be restored after we finish compiling the function
  2689.      (for use when compiling inline calls to this function).  */
  2690.   tree saved_block_tree = 0;
  2691.   /* Likewise, for DECL_ARGUMENTS.  */
  2692.   tree saved_arguments = 0;
  2693.   int failure = 0;
  2694.  
  2695.   if (output_bytecode)
  2696.     return;
  2697.  
  2698.   /* If we are reconsidering an inline function
  2699.      at the end of compilation, skip the stuff for making it inline.  */
  2700.  
  2701.   if (DECL_SAVED_INSNS (decl) == 0)
  2702.     {
  2703.       int specd = DECL_INLINE (decl);
  2704.       char *lose;
  2705.  
  2706.       /* If requested, consider whether to make this function inline.  */
  2707.       if (specd || flag_inline_functions)
  2708.     TIMEVAR (integration_time,
  2709.          {
  2710.            lose = function_cannot_inline_p (decl);
  2711.            /* If not optimizing, then make sure the DECL_INLINE
  2712.               bit is off.  */
  2713.            if (lose || ! optimize)
  2714.              {
  2715.                if (warn_inline && specd)
  2716.              warning_with_decl (decl, lose);
  2717.                DECL_INLINE (decl) = 0;
  2718.                DECL_ABSTRACT_ORIGIN (decl) = 0;
  2719.                /* Don't really compile an extern inline function.
  2720.               If we can't make it inline, pretend
  2721.               it was only declared.  */
  2722.                if (DECL_EXTERNAL (decl))
  2723.              {
  2724.                DECL_INITIAL (decl) = 0;
  2725.                goto exit_rest_of_compilation;
  2726.              }
  2727.              }
  2728.            else
  2729.              DECL_INLINE (decl) = 1;
  2730.          });
  2731.  
  2732.       insns = get_insns ();
  2733.  
  2734.       /* Dump the rtl code if we are dumping rtl.  */
  2735.  
  2736.       if (rtl_dump)
  2737.     TIMEVAR (dump_time,
  2738.          {
  2739.            fprintf (rtl_dump_file, "\n;; Function %s\n\n",
  2740.                 IDENTIFIER_POINTER (DECL_NAME (decl)));
  2741.            if (DECL_SAVED_INSNS (decl))
  2742.              fprintf (rtl_dump_file, ";; (integrable)\n\n");
  2743.            print_rtl (rtl_dump_file, insns);
  2744.            fflush (rtl_dump_file);
  2745.          });
  2746.  
  2747.       /* If function is inline, and we don't yet know whether to
  2748.      compile it by itself, defer decision till end of compilation.
  2749.      finish_compilation will call rest_of_compilation again
  2750.      for those functions that need to be output.  Also defer those
  2751.      functions that we are supposed to defer.  */
  2752.  
  2753.       if (DECL_DEFER_OUTPUT (decl)
  2754.       || ((specd || DECL_INLINE (decl))
  2755.           && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
  2756.            && ! flag_keep_inline_functions)
  2757.           || DECL_EXTERNAL (decl))))
  2758.     {
  2759.       DECL_DEFER_OUTPUT (decl) = 1;
  2760.  
  2761.       /* If -Wreturn-type, we have to do a bit of compilation.  */
  2762.       if (! warn_return_type)
  2763.         {
  2764. #ifdef DWARF_DEBUGGING_INFO
  2765.           /* Generate the DWARF info for the "abstract" instance
  2766.          of a function which we may later generate inlined and/or
  2767.          out-of-line instances of.  */
  2768.           if (write_symbols == DWARF_DEBUG)
  2769.         {
  2770.           set_decl_abstract_flags (decl, 1);
  2771.           TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
  2772.           set_decl_abstract_flags (decl, 0);
  2773.         }
  2774. #endif
  2775.           TIMEVAR (integration_time, save_for_inline_nocopy (decl));
  2776.           goto exit_rest_of_compilation;
  2777.         }
  2778.     }
  2779.  
  2780.       /* If we have to compile the function now, save its rtl and subdecls
  2781.      so that its compilation will not affect what others get.  */
  2782.       if (DECL_INLINE (decl) || DECL_DEFER_OUTPUT (decl))
  2783.     {
  2784. #ifdef DWARF_DEBUGGING_INFO
  2785.       /* Generate the DWARF info for the "abstract" instance of
  2786.          a function which we will generate an out-of-line instance
  2787.          of almost immediately (and which we may also later generate
  2788.          various inlined instances of).  */
  2789.       if (write_symbols == DWARF_DEBUG)
  2790.         {
  2791.           set_decl_abstract_flags (decl, 1);
  2792.           TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
  2793.           set_decl_abstract_flags (decl, 0);
  2794.         }
  2795. #endif
  2796.       saved_block_tree = DECL_INITIAL (decl);
  2797.       saved_arguments = DECL_ARGUMENTS (decl);
  2798.       TIMEVAR (integration_time, save_for_inline_copying (decl));
  2799.     }
  2800.  
  2801.       /* If specified extern inline but we aren't inlining it, we are
  2802.      done.  */
  2803.       if (specd && DECL_EXTERNAL (decl))
  2804.     goto exit_rest_of_compilation;
  2805.     }
  2806.  
  2807.   if (! DECL_DEFER_OUTPUT (decl))
  2808.     TREE_ASM_WRITTEN (decl) = 1;
  2809.  
  2810.   /* Now that integrate will no longer see our rtl, we need not distinguish
  2811.      between the return value of this function and the return value of called
  2812.      functions.  */
  2813.   rtx_equal_function_value_matters = 0;
  2814.  
  2815.   /* Don't return yet if -Wreturn-type; we need to do jump_optimize.  */
  2816.   if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
  2817.     {
  2818.       goto exit_rest_of_compilation;
  2819.     }
  2820.  
  2821.   /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
  2822.      Note that that may have been done above, in save_for_inline_copying.
  2823.      The call to resume_temporary_allocation near the end of this function
  2824.      goes back to the usual state of affairs.  */
  2825.  
  2826.   rtl_in_current_obstack ();
  2827.  
  2828. #ifdef FINALIZE_PIC
  2829.   /* If we are doing position-independent code generation, now
  2830.      is the time to output special prologues and epilogues.
  2831.      We do not want to do this earlier, because it just clutters
  2832.      up inline functions with meaningless insns.  */
  2833.   if (flag_pic)
  2834.     FINALIZE_PIC;
  2835. #endif
  2836.  
  2837.   insns = get_insns ();
  2838.  
  2839.   /* Copy any shared structure that should not be shared.  */
  2840.  
  2841.   unshare_all_rtl (insns);
  2842.  
  2843.   /* Instantiate all virtual registers.  */
  2844.  
  2845.   instantiate_virtual_regs (current_function_decl, get_insns ());
  2846.  
  2847.   /* See if we have allocated stack slots that are not directly addressable.
  2848.      If so, scan all the insns and create explicit address computation
  2849.      for all references to such slots.  */
  2850. /*   fixup_stack_slots (); */
  2851.  
  2852.   /* Do jump optimization the first time, if -opt.
  2853.      Also do it if -W, but in that case it doesn't change the rtl code,
  2854.      it only computes whether control can drop off the end of the function.  */
  2855.  
  2856.   if (optimize > 0 || extra_warnings || warn_return_type
  2857.       /* If function is `noreturn', we should warn if it tries to return.  */
  2858.       || TREE_THIS_VOLATILE (decl))
  2859.     {
  2860.       TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
  2861.       TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
  2862.     }
  2863.  
  2864.   /* Now is when we stop if -fsyntax-only and -Wreturn-type.  */
  2865.   if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
  2866.     goto exit_rest_of_compilation;
  2867.  
  2868.   /* Dump rtl code after jump, if we are doing that.  */
  2869.  
  2870.   if (jump_opt_dump)
  2871.     TIMEVAR (dump_time,
  2872.          {
  2873.            fprintf (jump_opt_dump_file, "\n;; Function %s\n\n",
  2874.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2875.            print_rtl (jump_opt_dump_file, insns);
  2876.            fflush (jump_opt_dump_file);
  2877.          });
  2878.  
  2879.   /* Perform common subexpression elimination.
  2880.      Nonzero value from `cse_main' means that jumps were simplified
  2881.      and some code may now be unreachable, so do
  2882.      jump optimization again.  */
  2883.  
  2884.   if (cse_dump)
  2885.     TIMEVAR (dump_time,
  2886.          {
  2887.            fprintf (cse_dump_file, "\n;; Function %s\n\n",
  2888.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2889.          });
  2890.  
  2891.   if (optimize > 0)
  2892.     {
  2893.       TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
  2894.  
  2895.       if (flag_thread_jumps)
  2896.     /* Hacks by tiemann & kenner.  */
  2897.     TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 1));
  2898.  
  2899.       TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
  2900.                      0, cse_dump_file));
  2901.       TIMEVAR (cse_time, delete_dead_from_cse (insns, max_reg_num ()));
  2902.  
  2903.       if (tem || optimize > 1)
  2904.     TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
  2905.     }
  2906.  
  2907.   /* Dump rtl code after cse, if we are doing that.  */
  2908.  
  2909.   if (cse_dump)
  2910.     TIMEVAR (dump_time,
  2911.          {
  2912.            print_rtl (cse_dump_file, insns);
  2913.            fflush (cse_dump_file);
  2914.          });
  2915.  
  2916.   if (loop_dump)
  2917.     TIMEVAR (dump_time,
  2918.          {
  2919.            fprintf (loop_dump_file, "\n;; Function %s\n\n",
  2920.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2921.          });
  2922.  
  2923.   /* Move constant computations out of loops.  */
  2924.  
  2925.   if (optimize > 0)
  2926.     {
  2927.       TIMEVAR (loop_time,
  2928.            {
  2929.          loop_optimize (insns, loop_dump_file);
  2930.            });
  2931.     }
  2932.  
  2933.   /* Dump rtl code after loop opt, if we are doing that.  */
  2934.  
  2935.   if (loop_dump)
  2936.     TIMEVAR (dump_time,
  2937.          {
  2938.            print_rtl (loop_dump_file, insns);
  2939.            fflush (loop_dump_file);
  2940.          });
  2941.  
  2942.   if (cse2_dump)
  2943.     TIMEVAR (dump_time,
  2944.          {
  2945.            fprintf (cse2_dump_file, "\n;; Function %s\n\n",
  2946.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2947.          });
  2948.  
  2949.   if (optimize > 0 && flag_rerun_cse_after_loop)
  2950.     {
  2951.       /* Running another jump optimization pass before the second
  2952.      cse pass sometimes simplifies the RTL enough to allow
  2953.      the second CSE pass to do a better job.  Jump_optimize can change
  2954.      max_reg_num so we must rerun reg_scan afterwards.
  2955.      ??? Rework to not call reg_scan so often.  */
  2956.       TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
  2957.       TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
  2958.  
  2959.       TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
  2960.       TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
  2961.                       1, cse2_dump_file));
  2962.       if (tem)
  2963.     TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
  2964.     }
  2965.  
  2966.   if (optimize > 0 && flag_thread_jumps)
  2967.     /* This pass of jump threading straightens out code
  2968.        that was kinked by loop optimization.  */
  2969.     TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
  2970.  
  2971.   /* Dump rtl code after cse, if we are doing that.  */
  2972.  
  2973.   if (cse2_dump)
  2974.     TIMEVAR (dump_time,
  2975.          {
  2976.            print_rtl (cse2_dump_file, insns);
  2977.            fflush (cse2_dump_file);
  2978.          });
  2979.  
  2980.   /* We are no longer anticipating cse in this function, at least.  */
  2981.  
  2982.   cse_not_expected = 1;
  2983.  
  2984.   /* Now we choose between stupid (pcc-like) register allocation
  2985.      (if we got the -noreg switch and not -opt)
  2986.      and smart register allocation.  */
  2987.  
  2988.   if (optimize > 0)            /* Stupid allocation probably won't work */
  2989.     obey_regdecls = 0;        /* if optimizations being done.  */
  2990.  
  2991.   regclass_init ();
  2992.  
  2993.   /* Print function header into flow dump now
  2994.      because doing the flow analysis makes some of the dump.  */
  2995.  
  2996.   if (flow_dump)
  2997.     TIMEVAR (dump_time,
  2998.          {
  2999.            fprintf (flow_dump_file, "\n;; Function %s\n\n",
  3000.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  3001.          });
  3002.  
  3003.   if (obey_regdecls)
  3004.     {
  3005.       TIMEVAR (flow_time,
  3006.            {
  3007.          regclass (insns, max_reg_num ());
  3008.          stupid_life_analysis (insns, max_reg_num (),
  3009.                        flow_dump_file);
  3010.            });
  3011.     }
  3012.   else
  3013.     {
  3014.       /* Do control and data flow analysis,
  3015.      and write some of the results to dump file.  */
  3016.  
  3017.       TIMEVAR (flow_time, flow_analysis (insns, max_reg_num (),
  3018.                      flow_dump_file));
  3019.       if (warn_uninitialized)
  3020.     {
  3021.       uninitialized_vars_warning (DECL_INITIAL (decl));
  3022.       setjmp_args_warning ();
  3023.     }
  3024.     }
  3025.  
  3026.   /* Dump rtl after flow analysis.  */
  3027.  
  3028.   if (flow_dump)
  3029.     TIMEVAR (dump_time,
  3030.          {
  3031.            print_rtl (flow_dump_file, insns);
  3032.            fflush (flow_dump_file);
  3033.          });
  3034.  
  3035.   /* If -opt, try combining insns through substitution.  */
  3036.  
  3037.   if (optimize > 0)
  3038.     TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
  3039.  
  3040.   /* Dump rtl code after insn combination.  */
  3041.  
  3042.   if (combine_dump)
  3043.     TIMEVAR (dump_time,
  3044.          {
  3045.            fprintf (combine_dump_file, "\n;; Function %s\n\n",
  3046.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  3047.            dump_combine_stats (combine_dump_file);
  3048.            print_rtl (combine_dump_file, insns);
  3049.            fflush (combine_dump_file);
  3050.          });
  3051.  
  3052.   /* Print function header into sched dump now
  3053.      because doing the sched analysis makes some of the dump.  */
  3054.  
  3055.   if (sched_dump)
  3056.     TIMEVAR (dump_time,
  3057.          {
  3058.            fprintf (sched_dump_file, "\n;; Function %s\n\n",
  3059.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  3060.          });
  3061.  
  3062.   if (optimize > 0 && flag_schedule_insns)
  3063.     {
  3064.       /* Do control and data sched analysis,
  3065.      and write some of the results to dump file.  */
  3066.  
  3067.       TIMEVAR (sched_time, schedule_insns (sched_dump_file));
  3068.     }
  3069.  
  3070.   /* Dump rtl after instruction scheduling.  */
  3071.  
  3072.   if (sched_dump)
  3073.     TIMEVAR (dump_time,
  3074.          {
  3075.            print_rtl (sched_dump_file, insns);
  3076.            fflush (sched_dump_file);
  3077.          });
  3078.  
  3079.   /* Unless we did stupid register allocation,
  3080.      allocate pseudo-regs that are used only within 1 basic block.  */
  3081.  
  3082.   if (!obey_regdecls)
  3083.     TIMEVAR (local_alloc_time,
  3084.          {
  3085.            regclass (insns, max_reg_num ());
  3086.            local_alloc ();
  3087.          });
  3088.  
  3089.   /* Dump rtl code after allocating regs within basic blocks.  */
  3090.  
  3091.   if (local_reg_dump)
  3092.     TIMEVAR (dump_time,
  3093.          {
  3094.            fprintf (local_reg_dump_file, "\n;; Function %s\n\n",
  3095.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  3096.            dump_flow_info (local_reg_dump_file);
  3097.            dump_local_alloc (local_reg_dump_file);
  3098.            print_rtl (local_reg_dump_file, insns);
  3099.            fflush (local_reg_dump_file);
  3100.          });
  3101.  
  3102.   if (global_reg_dump)
  3103.     TIMEVAR (dump_time,
  3104.          fprintf (global_reg_dump_file, "\n;; Function %s\n\n",
  3105.               IDENTIFIER_POINTER (DECL_NAME (decl))));
  3106.  
  3107.   /* Unless we did stupid register allocation,
  3108.      allocate remaining pseudo-regs, then do the reload pass
  3109.      fixing up any insns that are invalid.  */
  3110.  
  3111.   TIMEVAR (global_alloc_time,
  3112.        {
  3113.          if (!obey_regdecls)
  3114.            failure = global_alloc (global_reg_dump_file);
  3115.          else
  3116.            failure = reload (insns, 0, global_reg_dump_file);
  3117.        });
  3118.  
  3119.   if (global_reg_dump)
  3120.     TIMEVAR (dump_time,
  3121.          {
  3122.            dump_global_regs (global_reg_dump_file);
  3123.            print_rtl (global_reg_dump_file, insns);
  3124.            fflush (global_reg_dump_file);
  3125.          });
  3126.  
  3127.   if (failure)
  3128.     goto exit_rest_of_compilation;
  3129.  
  3130.   reload_completed = 1;
  3131.  
  3132.   /* On some machines, the prologue and epilogue code, or parts thereof,
  3133.      can be represented as RTL.  Doing so lets us schedule insns between
  3134.      it and the rest of the code and also allows delayed branch
  3135.      scheduling to operate in the epilogue.  */
  3136.  
  3137.   thread_prologue_and_epilogue_insns (insns);
  3138.  
  3139.   if (optimize > 0 && flag_schedule_insns_after_reload)
  3140.     {
  3141.       if (sched2_dump)
  3142.     TIMEVAR (dump_time,
  3143.          {
  3144.            fprintf (sched2_dump_file, "\n;; Function %s\n\n",
  3145.                 IDENTIFIER_POINTER (DECL_NAME (decl)));
  3146.          });
  3147.  
  3148.       /* Do control and data sched analysis again,
  3149.      and write some more of the results to dump file.  */
  3150.  
  3151.       TIMEVAR (sched2_time, schedule_insns (sched2_dump_file));
  3152.  
  3153.       /* Dump rtl after post-reorder instruction scheduling.  */
  3154.  
  3155.       if (sched2_dump)
  3156.     TIMEVAR (dump_time,
  3157.          {
  3158.            print_rtl (sched2_dump_file, insns);
  3159.            fflush (sched2_dump_file);
  3160.          });
  3161.     }
  3162.  
  3163. #ifdef LEAF_REGISTERS
  3164.   leaf_function = 0;
  3165.   if (optimize > 0 && only_leaf_regs_used () && leaf_function_p ())
  3166.     leaf_function = 1;
  3167. #endif
  3168.  
  3169.   /* One more attempt to remove jumps to .+1
  3170.      left by dead-store-elimination.
  3171.      Also do cross-jumping this time
  3172.      and delete no-op move insns.  */
  3173.  
  3174.   if (optimize > 0)
  3175.     {
  3176.       TIMEVAR (jump_time, jump_optimize (insns, 1, 1, 0));
  3177.     }
  3178.  
  3179.   /* Dump rtl code after jump, if we are doing that.  */
  3180.  
  3181.   if (jump2_opt_dump)
  3182.     TIMEVAR (dump_time,
  3183.          {
  3184.            fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n",
  3185.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  3186.            print_rtl (jump2_opt_dump_file, insns);
  3187.            fflush (jump2_opt_dump_file);
  3188.          });
  3189.  
  3190.   /* If a machine dependent reorganization is needed, call it.  */
  3191. #ifdef MACHINE_DEPENDENT_REORG
  3192.    MACHINE_DEPENDENT_REORG (insns);
  3193. #endif
  3194.  
  3195.   /* If a scheduling pass for delayed branches is to be done,
  3196.      call the scheduling code. */
  3197.  
  3198. #ifdef DELAY_SLOTS
  3199.   if (optimize > 0 && flag_delayed_branch)
  3200.     {
  3201.       TIMEVAR (dbr_sched_time, dbr_schedule (insns, dbr_sched_dump_file));
  3202.       if (dbr_sched_dump)
  3203.     {
  3204.       TIMEVAR (dump_time,
  3205.          {
  3206.            fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n",
  3207.                 IDENTIFIER_POINTER (DECL_NAME (decl)));
  3208.            print_rtl (dbr_sched_dump_file, insns);
  3209.            fflush (dbr_sched_dump_file);
  3210.          });
  3211.     }
  3212.     }
  3213. #endif
  3214.  
  3215.   /* Shorten branches.  */
  3216.   TIMEVAR (shorten_branch_time,
  3217.        {
  3218.          shorten_branches (get_insns ());
  3219.        });
  3220.  
  3221. #ifdef STACK_REGS
  3222.   TIMEVAR (stack_reg_time, reg_to_stack (insns, stack_reg_dump_file));
  3223.   if (stack_reg_dump)
  3224.     {
  3225.       TIMEVAR (dump_time,
  3226.            {
  3227.          fprintf (stack_reg_dump_file, "\n;; Function %s\n\n",
  3228.               IDENTIFIER_POINTER (DECL_NAME (decl)));
  3229.          print_rtl (stack_reg_dump_file, insns);
  3230.          fflush (stack_reg_dump_file);
  3231.            });
  3232.     }
  3233. #endif
  3234.  
  3235.   /* Now turn the rtl into assembler code.  */
  3236.  
  3237.   TIMEVAR (final_time,
  3238.        {
  3239.          rtx x;
  3240.          char *fnname;
  3241.  
  3242.          /* Get the function's name, as described by its RTL.
  3243.         This may be different from the DECL_NAME name used
  3244.         in the source file.  */
  3245.  
  3246.          x = DECL_RTL (decl);
  3247.          if (GET_CODE (x) != MEM)
  3248.            abort ();
  3249.          x = XEXP (x, 0);
  3250.          if (GET_CODE (x) != SYMBOL_REF)
  3251.            abort ();
  3252.          fnname = XSTR (x, 0);
  3253.  
  3254.          assemble_start_function (decl, fnname);
  3255.          final_start_function (insns, asm_out_file, optimize);
  3256.          final (insns, asm_out_file, optimize, 0);
  3257.          final_end_function (insns, asm_out_file, optimize);
  3258.          assemble_end_function (decl, fnname);
  3259.          fflush (asm_out_file);
  3260.        });
  3261.  
  3262.   /* Write DBX symbols if requested */
  3263.  
  3264.   /* Note that for those inline functions where we don't initially
  3265.      know for certain that we will be generating an out-of-line copy,
  3266.      the first invocation of this routine (rest_of_compilation) will
  3267.      skip over this code by doing a `goto exit_rest_of_compilation;'.
  3268.      Later on, finish_compilation will call rest_of_compilation again
  3269.      for those inline functions that need to have out-of-line copies
  3270.      generated.  During that call, we *will* be routed past here.  */
  3271.  
  3272. #ifdef DBX_DEBUGGING_INFO
  3273.   if (write_symbols == DBX_DEBUG)
  3274.     TIMEVAR (symout_time, dbxout_function (decl));
  3275. #endif
  3276.  
  3277. #ifdef DWARF_DEBUGGING_INFO
  3278.   if (write_symbols == DWARF_DEBUG)
  3279.     TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
  3280. #endif
  3281.  
  3282.  exit_rest_of_compilation:
  3283.  
  3284.   /* In case the function was not output,
  3285.      don't leave any temporary anonymous types
  3286.      queued up for sdb output.  */
  3287. #ifdef SDB_DEBUGGING_INFO
  3288.   if (write_symbols == SDB_DEBUG)
  3289.     sdbout_types (NULL_TREE);
  3290. #endif
  3291.  
  3292.   /* Put back the tree of subblocks and list of arguments
  3293.      from before we copied them.
  3294.      Code generation and the output of debugging info may have modified
  3295.      the copy, but the original is unchanged.  */
  3296.  
  3297.   if (saved_block_tree != 0)
  3298.     DECL_INITIAL (decl) = saved_block_tree;
  3299.   if (saved_arguments != 0)
  3300.     DECL_ARGUMENTS (decl) = saved_arguments;
  3301.  
  3302.   reload_completed = 0;
  3303.  
  3304.   /* Clear out the real_constant_chain before some of the rtx's
  3305.      it runs through become garbage.  */
  3306.  
  3307.   clear_const_double_mem ();
  3308.  
  3309.   /* Cancel the effect of rtl_in_current_obstack.  */
  3310.  
  3311.   resume_temporary_allocation ();
  3312.  
  3313.   /* The parsing time is all the time spent in yyparse
  3314.      *except* what is spent in this function.  */
  3315.  
  3316.   parse_time -= get_run_time () - start_time;
  3317. }
  3318.  
  3319. /* Entry point of cc1/c++.  Decode command args, then call compile_file.
  3320.    Exit code is 35 if can't open files, 34 if fatal error,
  3321.    33 if had nonfatal errors, else success.  */
  3322.  
  3323. int
  3324. main (argc, argv, envp)
  3325.      int argc;
  3326.      char **argv;
  3327.      char **envp;
  3328. {
  3329.   register int i;
  3330.   char *filename = 0;
  3331.   int flag_print_mem = 0;
  3332.   int version_flag = 0;
  3333.   char *p;
  3334.  
  3335.   /* save in case md file wants to emit args as a comment.  */
  3336.   save_argc = argc;
  3337.   save_argv = argv;
  3338.  
  3339.   p = argv[0] + strlen (argv[0]);
  3340.   while (p != argv[0] && p[-1] != '/'
  3341. #ifdef DIR_SEPARATOR
  3342.      && p[-1] != DIR_SEPARATOR
  3343. #endif
  3344. #ifdef VOL_SEPARATOR
  3345.      && p[-1] != VOL_SEPARATOR
  3346. #endif
  3347.      )
  3348.     --p;
  3349.   progname = p;
  3350.  
  3351. #ifdef RLIMIT_STACK
  3352.   /* Get rid of any avoidable limit on stack size.  */
  3353.   {
  3354.     struct rlimit rlim;
  3355.  
  3356.     /* Set the stack limit huge so that alloca does not fail. */
  3357.     getrlimit (RLIMIT_STACK, &rlim);
  3358.     rlim.rlim_cur = rlim.rlim_max;
  3359.     setrlimit (RLIMIT_STACK, &rlim);
  3360.   }
  3361. #endif /* RLIMIT_STACK */
  3362.  
  3363. #ifdef __amigados__
  3364.   {
  3365.     char *envstr;
  3366.  
  3367.     if (envstr = getenv("GCCPRIORITY"))
  3368.       if (((i = atoi(envstr)) > -20) && (i < 20)) amiga_priority = i;
  3369.   }
  3370. #endif /* __amigados__ */
  3371.  
  3372.   signal (SIGFPE, float_signal);
  3373.  
  3374. #ifdef SIGPIPE
  3375.   signal (SIGPIPE, pipe_closed);
  3376. #endif
  3377.  
  3378.   decl_printable_name = decl_name;
  3379.   lang_expand_expr = (struct rtx_def *(*)()) do_abort;
  3380.   interim_eh_hook = interim_eh;
  3381.  
  3382.   /* Initialize whether `char' is signed.  */
  3383.   flag_signed_char = DEFAULT_SIGNED_CHAR;
  3384. #ifdef DEFAULT_SHORT_ENUMS
  3385.   /* Initialize how much space enums occupy, by default.  */
  3386.   flag_short_enums = DEFAULT_SHORT_ENUMS;
  3387. #endif
  3388.  
  3389.   /* Scan to see what optimization level has been specified.  That will
  3390.      determine the default value of many flags.  */
  3391.   for (i = 1; i < argc; i++)
  3392.     {
  3393.       if (!strcmp (argv[i], "-O"))
  3394.     {
  3395.       optimize = 1;
  3396.     }
  3397.       else if (argv[i][0] == '-' && argv[i][1] == 'O')
  3398.     {
  3399.       /* Handle -O2, -O3, -O69, ...  */
  3400.       char *p = &argv[i][2];
  3401.       int c;
  3402.  
  3403.       while (c = *p++)
  3404.         if (! (c >= '0' && c <= '9'))
  3405.           break;
  3406.       if (c == 0)
  3407.         optimize = atoi (&argv[i][2]);
  3408.     }
  3409.     }
  3410.  
  3411.   obey_regdecls = (optimize == 0);
  3412.   if (optimize == 0)
  3413.     {
  3414.       flag_no_inline = 1;
  3415.       warn_inline = 0;
  3416.     }
  3417.  
  3418.   if (optimize >= 1)
  3419.     {
  3420.       flag_defer_pop = 1;
  3421.       flag_thread_jumps = 1;
  3422. #ifdef DELAY_SLOTS
  3423.       flag_delayed_branch = 1;
  3424. #endif
  3425. #ifdef CAN_DEBUG_WITHOUT_FP
  3426.       flag_omit_frame_pointer = 1;
  3427. #endif
  3428.     }
  3429.  
  3430.   if (optimize >= 2)
  3431.     {
  3432.       flag_cse_follow_jumps = 1;
  3433.       flag_cse_skip_blocks = 1;
  3434.       flag_expensive_optimizations = 1;
  3435.       flag_strength_reduce = 1;
  3436.       flag_rerun_cse_after_loop = 1;
  3437.       flag_caller_saves = 1;
  3438.       flag_force_mem = 1;
  3439. #ifdef INSN_SCHEDULING
  3440.       flag_schedule_insns = 1;
  3441.       flag_schedule_insns_after_reload = 1;
  3442. #endif
  3443.     }
  3444.  
  3445.   if (optimize >= 3)
  3446.     {
  3447.       flag_inline_functions = 1;
  3448.     }
  3449.  
  3450. #ifdef OPTIMIZATION_OPTIONS
  3451.   /* Allow default optimizations to be specified on a per-machine basis.  */
  3452.   OPTIMIZATION_OPTIONS (optimize);
  3453. #endif
  3454.  
  3455.   /* Initialize register usage now so switches may override.  */
  3456.   init_reg_sets ();
  3457.  
  3458.   target_flags = 0;
  3459.   set_target_switch ("");
  3460.  
  3461.   for (i = 1; i < argc; i++)
  3462.     {
  3463.       int j;
  3464.       /* If this is a language-specific option,
  3465.      decode it in a language-specific way.  */
  3466.       for (j = 0; lang_options[j] != 0; j++)
  3467.     if (!strncmp (argv[i], lang_options[j],
  3468.               strlen (lang_options[j])))
  3469.       break;
  3470.       if (lang_options[j] != 0)
  3471.     /* If the option is valid for *some* language,
  3472.        treat it as valid even if this language doesn't understand it.  */
  3473.     lang_decode_option (argv[i]);
  3474.       else if (argv[i][0] == '-' && argv[i][1] != 0)
  3475.     {
  3476.       register char *str = argv[i] + 1;
  3477.       if (str[0] == 'Y')
  3478.         str++;
  3479.  
  3480.       if (str[0] == 'm')
  3481.         set_target_switch (&str[1]);
  3482.       else if (!strcmp (str, "dumpbase"))
  3483.         {
  3484.           dump_base_name = argv[++i];
  3485.         }
  3486.       else if (str[0] == 'd')
  3487.         {
  3488.           register char *p = &str[1];
  3489.           while (*p)
  3490.         switch (*p++)
  3491.           {
  3492.            case 'a':
  3493.              combine_dump = 1;
  3494.              dbr_sched_dump = 1;
  3495.              flow_dump = 1;
  3496.              global_reg_dump = 1;
  3497.              jump_opt_dump = 1;
  3498.              jump2_opt_dump = 1;
  3499.              local_reg_dump = 1;
  3500.              loop_dump = 1;
  3501.              rtl_dump = 1;
  3502.              cse_dump = 1, cse2_dump = 1;
  3503.              sched_dump = 1;
  3504.              sched2_dump = 1;
  3505.             stack_reg_dump = 1;
  3506.             break;
  3507.           case 'k':
  3508.             stack_reg_dump = 1;
  3509.             break;
  3510.           case 'c':
  3511.             combine_dump = 1;
  3512.             break;
  3513.           case 'd':
  3514.             dbr_sched_dump = 1;
  3515.             break;
  3516.           case 'f':
  3517.             flow_dump = 1;
  3518.             break;
  3519.           case 'g':
  3520.             global_reg_dump = 1;
  3521.             break;
  3522.           case 'j':
  3523.             jump_opt_dump = 1;
  3524.             break;
  3525.           case 'J':
  3526.             jump2_opt_dump = 1;
  3527.             break;
  3528.           case 'l':
  3529.             local_reg_dump = 1;
  3530.             break;
  3531.           case 'L':
  3532.             loop_dump = 1;
  3533.             break;
  3534.           case 'm':
  3535.             flag_print_mem = 1;
  3536.             break;
  3537.           case 'p':
  3538.             flag_print_asm_name = 1;
  3539.             break;
  3540.           case 'r':
  3541.             rtl_dump = 1;
  3542.             break;
  3543.           case 's':
  3544.             cse_dump = 1;
  3545.             break;
  3546.           case 't':
  3547.             cse2_dump = 1;
  3548.             break;
  3549.           case 'S':
  3550.             sched_dump = 1;
  3551.             break;
  3552.           case 'R':
  3553.             sched2_dump = 1;
  3554.             break;
  3555.           case 'y':
  3556.             set_yydebug (1);
  3557.             break;
  3558.  
  3559.           case 'x':
  3560.             rtl_dump_and_exit = 1;
  3561.             break;
  3562.           }
  3563.         }
  3564.       else if (str[0] == 'f')
  3565.         {
  3566.           register char *p = &str[1];
  3567.           int found = 0;
  3568.  
  3569.           /* Some kind of -f option.
  3570.          P's value is the option sans `-f'.
  3571.          Search for it in the table of options.  */
  3572.  
  3573.           for (j = 0;
  3574.            !found && j < sizeof (f_options) / sizeof (f_options[0]);
  3575.            j++)
  3576.         {
  3577.           if (!strcmp (p, f_options[j].string))
  3578.             {
  3579.               *f_options[j].variable = f_options[j].on_value;
  3580.               /* A goto here would be cleaner,
  3581.              but breaks the vax pcc.  */
  3582.               found = 1;
  3583.             }
  3584.           if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
  3585.               && ! strcmp (p+3, f_options[j].string))
  3586.             {
  3587.               *f_options[j].variable = ! f_options[j].on_value;
  3588.               found = 1;
  3589.             }
  3590.         }
  3591.  
  3592.           if (found)
  3593.         ;
  3594.           else if (!strncmp (p, "fixed-", 6))
  3595.         fix_register (&p[6], 1, 1);
  3596.           else if (!strncmp (p, "call-used-", 10))
  3597.         fix_register (&p[10], 0, 1);
  3598.           else if (!strncmp (p, "call-saved-", 11))
  3599.         fix_register (&p[11], 0, 0);
  3600.           else
  3601.         error ("Invalid option `%s'", argv[i]);
  3602.         }
  3603.       else if (str[0] == 'O')
  3604.         {
  3605.           register char *p = str+1;
  3606.           while (*p && *p >= '0' && *p <= '9')
  3607.         p++;
  3608.           if (*p == '\0')
  3609.         ;
  3610.           else
  3611.         error ("Invalid option `%s'", argv[i]);
  3612.         }
  3613.       else if (!strcmp (str, "pedantic"))
  3614.         pedantic = 1;
  3615.       else if (!strcmp (str, "pedantic-errors"))
  3616.         flag_pedantic_errors = pedantic = 1;
  3617. #ifdef __amigados__
  3618.       else if (!strcmp (str, "priority"))
  3619.         {
  3620.           char *p = str + 1;
  3621.  
  3622.           if (*p)
  3623.         amiga_priority = atoi (p);
  3624.               if (amiga_priority < -25)
  3625.             amiga_priority = -25;
  3626.               else if (amiga_priority > 25)
  3627.             amiga_priority = 25;
  3628.         }
  3629. #endif /* __amigados__ */
  3630.       else if (!strcmp (str, "quiet"))
  3631.         quiet_flag = 1;
  3632.       else if (!strcmp (str, "version"))
  3633.         version_flag = 1;
  3634.       else if (!strcmp (str, "w"))
  3635.         inhibit_warnings = 1;
  3636.       else if (!strcmp (str, "W"))
  3637.         {
  3638.           extra_warnings = 1;
  3639.           /* We save the value of warn_uninitialized, since if they put
  3640.          -Wuninitialized on the command line, we need to generate a
  3641.          warning about not using it without also specifying -O.  */
  3642.           if (warn_uninitialized != 1)
  3643.         warn_uninitialized = 2;
  3644.         }
  3645.       else if (str[0] == 'W')
  3646.         {
  3647.           register char *p = &str[1];
  3648.           int found = 0;
  3649.  
  3650.           /* Some kind of -W option.
  3651.          P's value is the option sans `-W'.
  3652.          Search for it in the table of options.  */
  3653.  
  3654.           for (j = 0;
  3655.            !found && j < sizeof (W_options) / sizeof (W_options[0]);
  3656.            j++)
  3657.         {
  3658.           if (!strcmp (p, W_options[j].string))
  3659.             {
  3660.               *W_options[j].variable = W_options[j].on_value;
  3661.               /* A goto here would be cleaner,
  3662.              but breaks the vax pcc.  */
  3663.               found = 1;
  3664.             }
  3665.           if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
  3666.               && ! strcmp (p+3, W_options[j].string))
  3667.             {
  3668.               *W_options[j].variable = ! W_options[j].on_value;
  3669.               found = 1;
  3670.             }
  3671.         }
  3672.  
  3673.           if (found)
  3674.         ;
  3675.           else if (!strncmp (p, "id-clash-", 9))
  3676.         {
  3677.           char *endp = p + 9;
  3678.  
  3679.           while (*endp)
  3680.             {
  3681.               if (*endp >= '0' && *endp <= '9')
  3682.             endp++;
  3683.               else
  3684.             {
  3685.               error ("Invalid option `%s'", argv[i]);
  3686.               goto id_clash_lose;
  3687.             }
  3688.             }
  3689.           warn_id_clash = 1;
  3690.           id_clash_len = atoi (str + 10);
  3691.         id_clash_lose: ;
  3692.         }
  3693.           else if (!strncmp (p, "larger-than-", 12))
  3694.         {
  3695.           char *endp = p + 12;
  3696.  
  3697.           while (*endp)
  3698.             {
  3699.               if (*endp >= '0' && *endp <= '9')
  3700.             endp++;
  3701.               else
  3702.             {
  3703.               error ("Invalid option `%s'", argv[i]);
  3704.               goto larger_than_lose;
  3705.             }
  3706.             }
  3707.           warn_larger_than = 1;
  3708.           larger_than_size = atoi (str + 13);
  3709.         larger_than_lose: ;
  3710.         }
  3711.           else
  3712.         error ("Invalid option `%s'", argv[i]);
  3713.         }
  3714.       else if (!strcmp (str, "p"))
  3715.         {
  3716.           if (!output_bytecode)
  3717.         profile_flag = 1;
  3718.           else
  3719.         error ("profiling not supported in bytecode compilation");
  3720.         }
  3721.       else if (!strcmp (str, "a"))
  3722.         {
  3723. #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
  3724.           warning ("`-a' option (basic block profile) not supported");
  3725. #else
  3726.           profile_block_flag = 1;
  3727. #endif
  3728.         }
  3729.       else if (str[0] == 'g')
  3730.         {
  3731.           char *p = str + 1;
  3732.           char *q;
  3733.           unsigned len;
  3734.           unsigned level;
  3735.  
  3736.           while (*p && (*p < '0' || *p > '9'))
  3737.         p++;
  3738.           len = p - str;
  3739.           q = p;
  3740.           while (*q && (*q >= '0' && *q <= '9'))
  3741.         q++;
  3742.           if (*p)
  3743.         level = atoi (p);
  3744.           else
  3745.         level = 2;    /* default debugging info level */
  3746.           if (*q || level > 3)
  3747.         {
  3748.           warning ("invalid debug level specification in option: `-%s'",
  3749.                str);
  3750.           warning ("no debugging information will be generated");
  3751.           level = 0;
  3752.         }
  3753.  
  3754.           /* If more than one debugging type is supported,
  3755.          you must define PREFERRED_DEBUGGING_TYPE
  3756.          to choose a format in a system-dependent way.  */
  3757.           /* This is one long line cause VAXC can't handle a \-newline.  */
  3758. #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
  3759. #ifdef PREFERRED_DEBUGGING_TYPE
  3760.           if (!strncmp (str, "ggdb", len))
  3761.         write_symbols = PREFERRED_DEBUGGING_TYPE;
  3762. #else /* no PREFERRED_DEBUGGING_TYPE */
  3763. You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
  3764. #endif /* no PREFERRED_DEBUGGING_TYPE */
  3765. #endif /* More than one debugger format enabled.  */
  3766. #ifdef DBX_DEBUGGING_INFO
  3767.           if (write_symbols != NO_DEBUG)
  3768.         ;
  3769.           else if (!strncmp (str, "ggdb", len))
  3770.         write_symbols = DBX_DEBUG;
  3771.           else if (!strncmp (str, "gstabs", len))
  3772.         write_symbols = DBX_DEBUG;
  3773.           else if (!strncmp (str, "gstabs+", len))
  3774.         write_symbols = DBX_DEBUG;
  3775.  
  3776.           /* Always enable extensions for -ggdb or -gstabs+, 
  3777.          always disable for -gstabs.
  3778.          For plain -g, use system-specific default.  */
  3779.           if (write_symbols == DBX_DEBUG && !strncmp (str, "ggdb", len)
  3780.           && len >= 2)
  3781.         use_gnu_debug_info_extensions = 1;
  3782.           else if (write_symbols == DBX_DEBUG && !strncmp (str, "gstabs+", len)
  3783.                && len >= 7)
  3784.         use_gnu_debug_info_extensions = 1;
  3785.           else if (write_symbols == DBX_DEBUG
  3786.                && !strncmp (str, "gstabs", len) && len >= 2)
  3787.         use_gnu_debug_info_extensions = 0;
  3788.           else
  3789.         use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
  3790. #endif /* DBX_DEBUGGING_INFO */
  3791. #ifdef DWARF_DEBUGGING_INFO
  3792.           if (write_symbols != NO_DEBUG)
  3793.         ;
  3794.           else if (!strncmp (str, "g", len))
  3795.         write_symbols = DWARF_DEBUG;
  3796.           else if (!strncmp (str, "ggdb", len))
  3797.         write_symbols = DWARF_DEBUG;
  3798.           else if (!strncmp (str, "gdwarf", len))
  3799.         write_symbols = DWARF_DEBUG;
  3800.  
  3801.           /* Always enable extensions for -ggdb or -gdwarf+, 
  3802.          always disable for -gdwarf.
  3803.          For plain -g, use system-specific default.  */
  3804.           if (write_symbols == DWARF_DEBUG && !strncmp (str, "ggdb", len)
  3805.           && len >= 2)
  3806.         use_gnu_debug_info_extensions = 1;
  3807.           else if (write_symbols == DWARF_DEBUG && !strcmp (str, "gdwarf+"))
  3808.         use_gnu_debug_info_extensions = 1;
  3809.           else if (write_symbols == DWARF_DEBUG
  3810.                && !strncmp (str, "gdwarf", len) && len >= 2)
  3811.         use_gnu_debug_info_extensions = 0;
  3812.           else
  3813.         use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
  3814. #endif
  3815. #ifdef SDB_DEBUGGING_INFO
  3816.           if (write_symbols != NO_DEBUG)
  3817.         ;
  3818.           else if (!strncmp (str, "g", len))
  3819.         write_symbols = SDB_DEBUG;
  3820.           else if (!strncmp (str, "gdb", len))
  3821.         write_symbols = SDB_DEBUG;
  3822.           else if (!strncmp (str, "gcoff", len))
  3823.         write_symbols = SDB_DEBUG;
  3824. #endif /* SDB_DEBUGGING_INFO */
  3825. #ifdef XCOFF_DEBUGGING_INFO
  3826.           if (write_symbols != NO_DEBUG)
  3827.         ;
  3828.           else if (!strncmp (str, "g", len))
  3829.         write_symbols = XCOFF_DEBUG;
  3830.           else if (!strncmp (str, "ggdb", len))
  3831.         write_symbols = XCOFF_DEBUG;
  3832.           else if (!strncmp (str, "gxcoff", len))
  3833.         write_symbols = XCOFF_DEBUG;
  3834.  
  3835.           /* Always enable extensions for -ggdb or -gxcoff+,
  3836.          always disable for -gxcoff.
  3837.          For plain -g, use system-specific default.  */
  3838.           if (write_symbols == XCOFF_DEBUG && !strncmp (str, "ggdb", len)
  3839.           && len >= 2)
  3840.         use_gnu_debug_info_extensions = 1;
  3841.           else if (write_symbols == XCOFF_DEBUG && !strcmp (str, "gxcoff+"))
  3842.         use_gnu_debug_info_extensions = 1;
  3843.           else if (write_symbols == XCOFF_DEBUG
  3844.                && !strncmp (str, "gxcoff", len) && len >= 2)
  3845.         use_gnu_debug_info_extensions = 0;
  3846.           else
  3847.         use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
  3848. #endif          
  3849.           if (write_symbols == NO_DEBUG)
  3850.         warning ("`-%s' option not supported on this version of GCC", str);
  3851.           else if (level == 0)
  3852.         write_symbols = NO_DEBUG;
  3853.           else
  3854.         debug_info_level = (enum debug_info_level) level;
  3855.         }
  3856.       else if (!strcmp (str, "o"))
  3857.         {
  3858.           asm_file_name = argv[++i];
  3859.         }
  3860.       else if (str[0] == 'G')
  3861.         {
  3862.           g_switch_set = TRUE;
  3863.           g_switch_value = atoi ((str[1] != '\0') ? str+1 : argv[++i]);
  3864.         }
  3865.       else if (!strncmp (str, "aux-info", 8))
  3866.         {
  3867.           flag_gen_aux_info = 1;
  3868.           aux_info_file_name = (str[8] != '\0' ? str+8 : argv[++i]);
  3869.         }
  3870.       else
  3871.         error ("Invalid option `%s'", argv[i]);
  3872.     }
  3873.       else if (argv[i][0] == '+')
  3874.     error ("Invalid option `%s'", argv[i]);
  3875.       else
  3876.     filename = argv[i];
  3877.     }
  3878.  
  3879. #ifdef __amigados__
  3880.   Forbid();
  3881.   amiga_task = FindTask(NULL);
  3882.   Permit();
  3883.   amiga_old_priority = SetTaskPri(amiga_task, amiga_priority);
  3884. #endif /* __amigados__ */
  3885.  
  3886.   /* Initialize for bytecode output.  A good idea to do this as soon as
  3887.      possible after the "-f" options have been parsed. */
  3888.   if (output_bytecode)
  3889.     {
  3890. #ifndef TARGET_SUPPORTS_BYTECODE
  3891.       /* Just die with a fatal error if not supported */
  3892.       fatal ("-fbytecode not supporter for this target");
  3893. #else
  3894.       bc_initialize ();
  3895. #endif
  3896.     }
  3897.  
  3898.   if (optimize == 0)
  3899.     {
  3900.       /* Inlining does not work if not optimizing,
  3901.      so force it not to be done.  */
  3902.       flag_no_inline = 1;
  3903.       warn_inline = 0;
  3904.  
  3905.       /* The c_decode_option and lang_decode_option functions set
  3906.      this to `2' if -Wall is used, so we can avoid giving out
  3907.      lots of errors for people who don't realize what -Wall does.  */
  3908.       if (warn_uninitialized == 1)
  3909.     warning ("-Wuninitialized is not supported without -O");
  3910.     }
  3911.  
  3912. #if defined(DWARF_DEBUGGING_INFO)
  3913.   if (write_symbols == DWARF_DEBUG
  3914.       && strcmp (language_string, "GNU C++") == 0)
  3915.     {
  3916.       warning ("-g option not supported for C++ on SVR4 systems");
  3917.       write_symbols = NO_DEBUG;
  3918.     }
  3919. #endif /* defined(DWARF_DEBUGGING_INFO) */
  3920.  
  3921. #ifdef OVERRIDE_OPTIONS
  3922.   /* Some machines may reject certain combinations of options.  */
  3923.   OVERRIDE_OPTIONS;
  3924. #endif
  3925.  
  3926.   /* Unrolling all loops implies that standard loop unrolling must also
  3927.      be done.  */
  3928.   if (flag_unroll_all_loops)
  3929.     flag_unroll_loops = 1;
  3930.   /* Loop unrolling requires that strength_reduction be on also.  Silently
  3931.      turn on strength reduction here if it isn't already on.  Also, the loop
  3932.      unrolling code assumes that cse will be run after loop, so that must
  3933.      be turned on also.  */
  3934.   if (flag_unroll_loops)
  3935.     {
  3936.       flag_strength_reduce = 1;
  3937.       flag_rerun_cse_after_loop = 1;
  3938.     }
  3939.  
  3940.   /* Warn about options that are not supported on this machine.  */
  3941. #ifndef INSN_SCHEDULING
  3942.   if (flag_schedule_insns || flag_schedule_insns_after_reload)
  3943.     warning ("instruction scheduling not supported on this target machine");
  3944. #endif
  3945. #ifndef DELAY_SLOTS
  3946.   if (flag_delayed_branch)
  3947.     warning ("this target machine does not have delayed branches");
  3948. #endif
  3949.  
  3950.   /* If we are in verbose mode, write out the version and maybe all the
  3951.      option flags in use.  */
  3952.   if (version_flag)
  3953.     {
  3954.       fprintf (stderr, "%s version %s", language_string, version_string);
  3955. #ifdef TARGET_VERSION
  3956.       TARGET_VERSION;
  3957. #endif
  3958. #ifdef __GNUC__
  3959. #ifndef __VERSION__
  3960. #define __VERSION__ "[unknown]"
  3961. #endif
  3962.       fprintf (stderr, " compiled by GNU C version %s.\n", __VERSION__);
  3963. #else
  3964.       fprintf (stderr, " compiled by CC.\n");
  3965. #endif
  3966.       if (! quiet_flag)
  3967.     print_switch_values ();
  3968.     }
  3969.  
  3970.   compile_file (filename);
  3971.  
  3972. #if !defined(OS2) && !defined(VMS) && !defined(_WIN32) && !defined (__amigados__)
  3973.   if (flag_print_mem)
  3974.     {
  3975. #ifdef __alpha
  3976.       char *sbrk ();
  3977. #endif
  3978.       char *lim = (char *) sbrk (0);
  3979.  
  3980.       fprintf (stderr, "Data size %d.\n",
  3981.            lim - (char *) &environ);
  3982.       fflush (stderr);
  3983.  
  3984. #ifdef USG
  3985.       system ("ps -l 1>&2");
  3986. #else /* not USG */
  3987.       system ("ps v");
  3988. #endif /* not USG */
  3989.     }
  3990. #endif /* not OS2 and not VMS and not _WIN32 and not __amigados__ */
  3991.  
  3992. /* PhB 25-Jun-95: restore old process priority before exiting */
  3993. #ifdef __amigados__
  3994.   SetTaskPri(amiga_task, amiga_old_priority);
  3995. #endif /* __amigados__ */
  3996.  
  3997.  
  3998.   if (errorcount)
  3999.     exit (FATAL_EXIT_CODE);
  4000.   if (sorrycount)
  4001.     exit (FATAL_EXIT_CODE);
  4002.   exit (SUCCESS_EXIT_CODE);
  4003.   return 0;
  4004. }
  4005.  
  4006. /* Decode -m switches.  */
  4007.  
  4008. /* Here is a table, controlled by the tm.h file, listing each -m switch
  4009.    and which bits in `target_switches' it should set or clear.
  4010.    If VALUE is positive, it is bits to set.
  4011.    If VALUE is negative, -VALUE is bits to clear.
  4012.    (The sign bit is not used so there is no confusion.)  */
  4013.  
  4014. struct {char *name; int value;} target_switches []
  4015.   = TARGET_SWITCHES;
  4016.  
  4017. /* This table is similar, but allows the switch to have a value.  */
  4018.  
  4019. #ifdef TARGET_OPTIONS
  4020. struct {char *prefix; char ** variable;} target_options []
  4021.   = TARGET_OPTIONS;
  4022. #endif
  4023.  
  4024. /* Decode the switch -mNAME.  */
  4025.  
  4026. void
  4027. set_target_switch (name)
  4028.      char *name;
  4029. {
  4030.   register int j;
  4031.   int valid = 0;
  4032.  
  4033.   for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
  4034.     if (!strcmp (target_switches[j].name, name))
  4035.       {
  4036.     if (target_switches[j].value < 0)
  4037.       target_flags &= ~-target_switches[j].value;
  4038.     else
  4039.       target_flags |= target_switches[j].value;
  4040.     valid = 1;
  4041.       }
  4042.  
  4043. #ifdef TARGET_OPTIONS
  4044.   if (!valid)
  4045.     for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
  4046.       {
  4047.     int len = strlen (target_options[j].prefix);
  4048.     if (!strncmp (target_options[j].prefix, name, len))
  4049.       {
  4050.         *target_options[j].variable = name + len;
  4051.         valid = 1;
  4052.       }
  4053.       }
  4054. #endif
  4055.  
  4056.   if (!valid)
  4057.     error ("Invalid option `%s'", name);
  4058. }
  4059.  
  4060. /* Variable used for communication between the following two routines.  */
  4061.  
  4062. static int line_position;
  4063.  
  4064. /* Print an option value and adjust the position in the line.  */
  4065.  
  4066. static void
  4067. print_single_switch (type, name)
  4068.      char *type, *name;
  4069. {
  4070.   fprintf (stderr, " %s%s", type, name);
  4071.  
  4072.   line_position += strlen (type) + strlen (name) + 1;
  4073.  
  4074.   if (line_position > 65)
  4075.     {
  4076.       fprintf (stderr, "\n\t");
  4077.       line_position = 8;
  4078.     }
  4079. }
  4080.      
  4081. /* Print default target switches for -version.  */
  4082.  
  4083. static void
  4084. print_switch_values ()
  4085. {
  4086.   register int j;
  4087.  
  4088.   fprintf (stderr, "enabled:");
  4089.   line_position = 8;
  4090.  
  4091.   for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
  4092.     if (*f_options[j].variable == f_options[j].on_value)
  4093.       print_single_switch ("-f", f_options[j].string);
  4094.  
  4095.   for (j = 0; j < sizeof W_options / sizeof W_options[0]; j++)
  4096.     if (*W_options[j].variable == W_options[j].on_value)
  4097.       print_single_switch ("-W", W_options[j].string);
  4098.  
  4099.   for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
  4100.     if (target_switches[j].name[0] != '\0'
  4101.     && target_switches[j].value > 0
  4102.     && ((target_switches[j].value & target_flags)
  4103.         == target_switches[j].value))
  4104.       print_single_switch ("-m", target_switches[j].name);
  4105.  
  4106.   fprintf (stderr, "\n");
  4107. }
  4108.